Root password in term or xterm

Hi, I am a newbie, please be gentle. I have just set up FreeBSD 9, then X, then KDE 4. I have set it up so KDE loads automatically. Then in KDE I have started an xterm. It loads with the $ prompt so I type login and try to login as root because I want to install packages and the installs keep failing using the user log in. So at the word login I type root, then enter the root password. It says login incorrect. So several reboots later, and a lot of reading I wonder if my password is too long or some other issue. Back to the manual and I figure out how to change the root password back at the single user login screen. That worked fine. So back into KDE and try xterm. Same message. Are there two places for root passwords? Then I have spent a lot of time looking through forums as I don't not want to waste your time but simply cannot find the solution. Any help please.:)
 
To switch to the root account you can use the su() command (you have to be in the group wheel to switch to the root account with su()). To run single commands as root, you can install security/sudo.
 
Hi there and welcome aboard.

Tbird said:
I have started x term. It loads with the $ prompt so I type login and try to login as root because I want to install packages and the installs keep failing using the user log in. So at the word login I type root, then enter the root password. It says login incorrect. So several reboots later, and a lot of reading I wonder if my password is too long or some other issue.
The others already explained how you can circumvent this issue and still obtain root privileges.

I'd like to take it one step further and (try to) explain to you what is happening here because that is in my opinion also important to know.

As you may know the root user (which has uid 0) is a special account; it has complete control over your system. And don't think too lightly of this; one single command while using this account can totally destroy your system.

Therefore it is important to be careful when using this account as well as keep some control over where the account is being used.

And that's where /etc/ttys comes into play. This file does a lot of things; amongst which determine on which (virtual) consoles the root account may login. By default this is on the main console, the virtual consoles ttyv0 to ttyv8, the serial terminals (ttyu0 to ttyu4) and the so called 'dumb' console dcons.

You can check which console you're using by running tty.

Now, when I'm logged onto my server (I always use the commandline together with sysutils/tmux) I'm using this one which isn't mentioned in /etc/ttys:

Code:
smtp2:/home/peter $ tty
/dev/pts/5
smtp2:/home/peter $ grep pts /etc/ttys
smtp2:/home/peter $
And that means that I simply cannot login as root while using this console.

So the right approach here, others have already explained as much, is using su or perhaps security/sudo.

Small tip: if you want to 'emulate' a full login as root (meaning so much as: you want your environment (such as your PATH) to be set to that of root) then you should use the su - command. If you simply want to obtain root privileges then a mere su will suffice.

Hope this gives you some ideas.

Edit:

PS: If you want to know more about those (virtual) consoles then you might want to check out chapter 4.2 of the FreeBSD handbook.
 
To make it simple (keeping in mind what @ShelLuser wrote).
  1. Add the user to the wheel group: $ pw usermod [i]username[/i] -G wheel, see pw(8) for more information.
  2. Promote to the root user in the shell: $ su - and enter the root password.
 
Last edited by a moderator:
Back
Top