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


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


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 identity

SYNOPSIS 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.)

  • is 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 Mar 13 '12 at 11:04
  • the screenshot imageshack.us/photo/my-images/694/errunix2.png – pstnc Mar 13 '12 at 11:13
  • Please see my edit :) – sr_ Mar 13 '12 at 11:20
  • hi 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 – pstnc Mar 13 '12 at 11:43
  • Really 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). – sr_ Mar 13 '12 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.