You have many options, including su
, login
, ssh
, and sudo
.
The easiest way is to run su, e.g.
$ su otheruser
or
$ su - otheruser
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
for sh
or .login
for csh
), to make it seem like you've logged in as that user.
If otheruser
is root
(or is missing, which also means root
), then you will need to be in the wheel
group, as per the man page:
by default only users in the wheel
group can switch to UID 0 (root
).
Another way is login, e.g.
$ login
login: otheruser
Password:
Or, if you are running sshd, you could use ssh, e.g.
$ ssh otheruser@localhost
Or you could install sudo using ports.
# cd /usr/ports/security/sudo
# make && make install
or packages
# pkg_add -r sudo
See the sudo man page for details of how to run it.
Best Answer
pw
is the command you are looking for. To add userklaatu
to the groupfoo
, do:Here is the FreeBSD handbook page on the subject. It's an easy and informative read: Users and Basic Account Management