How can I switch one user to another in Freebsd?
For examples, I am user david now and I want to change to user Bob.
This is a personal OS for my study. not a server.
I searched it, but only got sites about how to create new user.
Thank you.
freebsdusers
How can I switch one user to another in Freebsd?
For examples, I am user david now and I want to change to user Bob.
This is a personal OS for my study. not a server.
I searched it, but only got sites about how to create new user.
Thank you.
Best Answer
You have many options, including
su
,login
,ssh
, andsudo
.The easiest way is to run su, e.g.
or
The first one sets your user to
otheruser
.The second one sets you user to
otheruser
and sources otheruser's login scripts (e.g..profile
forsh
or.login
forcsh
), to make it seem like you've logged in as that user.If
otheruser
isroot
(or is missing, which also meansroot
), then you will need to be in thewheel
group, as per the man page:Another way is login, e.g.
Or, if you are running sshd, you could use ssh, e.g.
Or you could install sudo using ports.
or packages
See the sudo man page for details of how to run it.