Operate apache

/etc/init.d/apache2 restart

sudo /etc/init.d/apache2 restart

sudo service apache2 restart

Check Ubuntu version:

lsb_release -a

Creating a new user:

sudo adduser UserName

Disallow user from login:

sudo usermod --expiredate 1 UserName

To reenable that account, set expiration date of user to Never:

sudo usermod --expiredate "" UserName




Creating a group:

sudo addgroup groupName

Creating a user into this group:

sudo adduser userName groupName

Adding an existing user to another group:

sudo usermod -a -G groupName userName

Change folder permissions and ownership:

sudo chown -R username:group directory

List the members of a group:

getent group groupname

To list all local users you can use:

cut -d: -f1 /etc/passwd

To add a new user you can use:

sudo adduser new_username


sudo useradd new_username

To remove/delete a user, first you can use:

sudo userdel username

Then you may want to delete the home directory for the deleted user account :

sudo rm -r /home/username

To modify the username of a user:

usermod -l new_username old_username

To change the password for a user:

sudo passwd username

To change the shell for a user:

sudo chsh username

To change the details for a user (for example real name):

sudo chfn username

To add existing user to an existing group

sudo usermod -a -G groupName userName

Change folder ownership

sudo chown -R userName:groupName DirectoryPath 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s