How to add and remove user’s in Ubuntu.
Posted January 14, 2007on:
How to add a user in Ubuntu (and how to create a home directory)
useradd -m ballen
All should then work fine.
How to delete a user’s account (and how to also delete the home directory too)
userdel ballen – Just removes the users account
userdel -r ballen – Removes the account and the users home directory.
How to view all user accounts:
Users – cat /etc/passwd | cut -d: -f1
Groups – cat /etc/group | cut -d: -f1
How to create auto-home directory folders:
Some times you may want to deploy automatic folders to user’s home directory’s when the account is created for example ‘public_html’ is a directory that when Apache is running can be configured for personal website hosting and the users personal website can be viewed at: http://example.com/~username (depending on the apache configuration) therefore you may want to create this public_html folder to automatically add to the user’s home dir, To do this we have to create a folder in the /etc/skel directory (stands for Skeleton) and give it the correct permissions, This can be done using the following commands:-
chmod 777 public_html/
Now a folder named public_html has been created in /etc/skel and the correct permissions have been added so that web users can view and read any data on the user’s site. All you need to do now (if it isn’t already) is to configure Apache to serve User home directorys.