switching from user to root and revers (FreeBSD)
Try su
, to gain a root shell as a user, enter root's password when asked. See man su
for more info:
NAME
su
— substitute user identitySYNOPSIS
su [-] [-flms] [-c class] [login [args]]
DESCRIPTION The
su
utility requests appropriate user credentials via PAM and switches to that user ID (the default user is the superuser). A shell is then executed.
It also lets you switch from root to user, just use su - loginname
The ports error you posted comes from running make install
as a non-root user, so using su
first, everything should be fine. Be aware that you can also grab a binary packages via pkg_add -r sudo
(as root).
Edit I just had a closer look, could it be that your root account's shell is set to /usr/local/bin/bash
but that this file does not exist? If so, check this forum thread on how to resolve the "root shell messed up" issue, and give this a try:
$ su -m root -c /bin/csh
Password: # <-- root password
# chsh # <-- change root shell
(But also read the hints on using the toor
user as a better admin account while leaving root
safe and intact.)
Comments
-
pstnc over 1 year
I want to make some modification with root and then with my user, in fact I want to install sudo and he give me the error in the first step:
cd /usr/ports/security/sudo make install clean
http://imageshack.us/photo/my-images/821/errorunix.png/
I was trying to log in with root in another session
Alt+F2
but after entry the login and the password the system keep going to ask me to put again the user and the password .. so what is wrong??I searched in the FreeBSD handbook http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ but nothing!! how this is possible??
Later EDIT: apologize., that in fact here is 2 questions., one about how to switch from user to root and then from root to user and the problem with sudo, thank you
-
pstnc about 12 yearsis a very good answer sr_., but unfortunately i try su and then i put the password, i have the same pass to my 2 users - root and pstnc (pstnc is a user that i created manually) and give me the error: BAD SU pstnc to root, see the screenshot please., and thank you .. best regards
-
pstnc about 12 yearsthe screenshot imageshack.us/photo/my-images/694/errunix2.png
-
sr_ about 12 yearsPlease see my edit
:)
-
pstnc about 12 yearshi again, i try it and is still not working .. i try the 3 solutions, 2 from the forum topic and yours, but unsuccessfully :( i attach the screenshot with my tests imageshack.us/photo/my-images/826/errorunix3.png .. Question: i dont now if have something to do with that yesterday i create 2 new sessions Alt+F2, Alt+F3 and for that reason is not working!?! just asking
-
sr_ about 12 yearsReally try this, i.e. boot in single user mode etc., but change the root shell (
chsh root
) to/bin/csh
, not/usr/local/bin/bash
(since it doesn't exist). -
pstnc about 12 yearsohh i'm so sorry sr_ you came like a good man to solve a problem, but little by little i put you in a lot of problems of a strange situation that i have., right now is impossible to boot my virtual machine i attach the screenshot imageshack.us/photo/my-images/855/thisgotofar.png
-
sr_ about 12 yearsI don't know how to use VMWare player, can't you just kill it? Using the virtual equivalent of pulling the plug? (if there's nothing unsaved to lose.)
-
pstnc about 12 yearsi try it in another pc and is work perfectly., for the rest of the problems i start a new topic, because something is wrong with what i have in my laptop.. thank you