Tag: user

  • How to find the user id – uid – for a user in Linux

     

    This one is straight-forward for CentOS, Ubuntu and others distros:

     

    id -u [username]

     

    e.g.

     

    id -u bob

     

    That will give a numeric result like 500 or 1001.

  • Ubuntu: How to delete a user

     

    In Ubuntu 12.04 and 12.10, to delete an additional user you have created, use the following:

     

    sudo deluser [username]

     

    By example, if we wanted to delete a user we created called “test”, we would run:

     

    sudo deluser test

     

    Which gives:

     

    Removing user `test’ …

    Warning: group `test’ has no more members.

    Done.

     

    Be careful with this – don’t delete your admin account 🙂

  • Ubuntu: How to add a existing user to an existing group

     

    To add an existing user to a second group, use the following command:

     

    sudo usermod -a -G [group] [user]

     

    e.g.:

     

    sudo usermod -a -G geeks bob

     

    This will add the user bob to the group geeks.

  • Ubuntu Server: How to change to the root user

     

    Some guides tell you to enter “su” on Unix systems to get superuser permissions; in Ubuntu, however, this won’t work. As a user with sudo permissions (the user created on install has these) enter the following instead:

     

    sudo su

     

    Enter your account password and voila, you are logged in as root. You can tell when you are logged in as root as your prompt will look like:

     

    root@luna:/home/#

     

    rather than:

     

    tma1@luna:/home$

     

     

    Note the # rather than the $? This indicates that you’re performing actions as the root user. This can be dangerous as you will be able to do things which can wreck your system irreparably, so be careful! To go back to working as your usual user, type:

     

    exit

     

    or hit CTRL+D.