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.