Trying to switch accounts to my newly created account I get a black screen and then it takes me back to the main login screen after entering the correct password.
Upon logging into my previously existing account I get:
"System Program Problem Detected"
Details:
Executable path /usr/bin/Xorg
Package: xserver-xorg-core 2:1.11.4-0ubuntu10.1
Details: Crash
... (tons more, but no way to copy paste or save)
When I try to su
su -l penner
I get:
No directory, logging in with HOME=/
I manually created the home directory and this error goes away but still no luck with the login. Seems something has gone wrong with the user creation? How can I correct this?
If you created the user account with
useradd
, you have to set up everything for it manually. This is why, when creating user accounts from the command-line, it is recommended to useadduser
in Ubuntu (and Debian, and other Debian-based systems) instead. You might just want to remove the user withuserdel
ordeluser
and recreate it withadduser
. Otherwise...Fixing the Home Directory Location
If you want to keep the user account and fix the problem, then you need to look at:
These must be exactly the same. The error message you get with
su -l penner
is telling you that they are not the same.To check the home directory the user account is actually configured for, run this command (see
man 5 passwd
andman grep
for more information):You should see a line like this:
That is, the sixth
:
-separated field (after the fifth:
) contains the home directory. If it's not/home/penner
, it should be. If the directory you created for the user is not/home/penner
, it should be, too. If the two directories are the same but neither one is/home/penner
, then that might theoretically work, but you should make them both/home/penner
, because lots of software assumes that all non-root
users' home directories are/home/username
.You can change
penner
's home directory to/home/penner
by running this command:man usermod
for more information.Ensuring it is a Directory, and that the User Has Access
If (or once) the names are both
/home/penner
, you should also make sure that the user has access to their own home directory. Run:You should see something that looks like this (though the date and time will be different):
If instead of
drwxr-xr-x
, you have something that starts with-
rather thand
, then you created a file rather than a directory. Delete the file and make a directory there instead.If instead of the first
penner
you have something else, then the user doesn't own their home directory, so make them own it:man chown
for more information.If instead of
drwxr-xr-x
there are dashes in the next three characters after thed
, then the user doesn't have full access there. Fix that as follows:man chmod
for more information.(
penner
is capable of running this command if they own their home directory, so if you prefer, you can run this as:sudo -u penner u+rwx /home/penner
)Ensuring Other Users Don't Have Blanket Write Access
If instead of
drwxr-xr-x
, there arew
s instead of-
s in the last six letters, then users besidespenner
may have write access topenner
's home directory. This is dangerous (unless you really know what you're doing and want it this way and have set things up so it won't be a problem). To fix it:Other Defaults
There are some other changes you may want to make. By default in Ubuntu (that is, if you create a user account with
adduser
or with a graphical tool, which you did not):Home directories have read and write permissions for everyone, not just the user who owns them. Users can change this, either for the whole home directory or any files and subdirectories inside it. But if you do want this default, and you don't have the second and third
r
andx
indrwxr-xr-x
, run:(
penner
is capable of running this command if they own their home directory, so if you prefer, you can run this as:sudo -u penner chmod 755 /home/penner
)Each user has his/her own group, with the same name as the user, and this is the user's primary group. Their home directory is owned by this group. That's the meaning of the second
penner
indrwxr-xr-x 43 penner penner 4096 2012-07-03 06:41 /home/penner
. It's OK to break with this default, if you know what you are doing. But if it's not your intention to do things differently, you should make surepenner
is set up this way, since some possible primary group identities for a user, or group owners on the user's home directory, could lead to security problems.Run
groups penner
. (Seeman groups
for more information.) You should see something like this:Don't worry if it's not quite like that. I'll get to that soon. Instead, look at the first word after the
:
. That's the name of the user's primary group. Assuming you want it to bepenner
, make sure it is. If it isn't, change it:If you get an error saying that the group
penner
doesn't exist, then you'll have to create it with this command (and then run the above command again):man addgroup
for more information. (If you prefer, you can alternatively use thegroupadd
command to create groups.)When you ran
groups penner
, you may have gotten a list of groups considerably shorter than mypenner : penner adm dialout cdrom plugdev lpadmin sambashare
. For desktop users, theadm
,dialout
,cdrom
,plugdev
,lpadmin
, andsambashare
provide abilities that desktop users should generally have. Therefore, unless you have a reason to do otherwise,penner
should be in these groups. These are not primary groups, however, so they're set differently. Supposingpenner
is not in any of these groups and you wantpenner
to be in all of them, run this command:In case you're interested, here's what all those groups mean:
adm
users can view most system log files in/var/log
.dialout
users can use dial-up modems.plugdev
users can mount and use external storage devices.lpadmin
users can set up and manage printers.sambashare
users can share files (via Samba) with other computers over a network.(Source: Privileges, in the Ubuntu documentation wiki.)
Making the User an Administrator
If you don't want
penner
to be an administrator, you probably don't need to do anything else. You can check ifpenner
is an administrator withgroups penner
. If neitheradmin
norsudo
is listed, thenpenner
is not an administrator.If you want
penner
to be an administrator, addpenner
to whichever of these groups exists. (You may as well addpenner
to both, if they both exist.) You can accomplish that by running these two commands separately--if either one succeeds, you've madepenner
an administrator:admin
group. Starting with Ubuntu 12.04 LTS, administrators are in thesudo
group. But if your 12.04 LTS system is upgraded from a previous release (and this should apply to later Ubuntu releases, such as 12.10 when it comes out, that are upgraded from Ubuntu 11.10 or earlier), then for backward compatibility, administrators are members of bothsudo
andadmin
. Generally, if one of these groups doesn't confer administrative abilities, it simply doesn't exist, so running both the above two commands (separately, not assudo usermod -a -G admin,sudo penner
) is generally a safe and effective way to makepenner
an administrator.This mostly happens when you create the user without creating a home directory for the user. This can be solved by using this command when creating user
The -m flag is what creates the home directory for the user. After creating the user check if the home directory exists for that user by doing
If you can see that username listed there then the last thing to do is assign a password to that user
You can now login with that username and password
ctrl+alt+f1 and login there and run
sudo chown -R $USER:$USER $HOME
then press ctrl+alt+f7 and try to login
It will work