22 Jan 2012

Adding a non-root user on BackTrack 5R1

After installation of BackTrack 5 R1, there is only one user: root (or superuser). Root has full privileges in the operating system, and that makes our system more vulnerable to external attacks. A superuser can manage other user’s account, administer user data, install new applications, and configure system services and others. And of course, we can be that attacker if and when we mess up.

When installing on a hard disk and also using the system for some research and communication on occasion, we best create a non-root user with limited privileges and use su and sudo when we need more.

Adding a user
Adding user to groups
Add user to sudoers file
User switcher
Deleting user
More with man


Adding a user


Use command (a) adduser or (b) useradd. Both commands will create a new user account in BackTrack 5 R1 (Tested with Gnome).

Code:

adduser [options] [--home  DIR] [--shell  SHELL] [--no-create-home]
       [--uid ID] [--firstuid ID] [--lastuid ID] [--ingroup GROUP | --gid  ID]
       [--disabled-password] [--disabled-login] [--gecos      GECOS]
       [--add_extra_groups] [--encrypt-home] username

Example: adduser lilith





Adding user to groups


You still need to add the user to the admin, disk, cdrom and audio groups, which will allow it to use the sudo command as well as access the cdrom, other disk devices and your sound card. Replace "lilith" with the name of the user you just created with adduser. If you make a mistake you can remove the user with userdel or deluser.

Run the command:

usermod --groups admin,disk,cdrom,audio lilith


Add user to sudoers file

For the non-root user to be able to sudo, add the user to the /etc/sudoers file. This file is read-only, so you'll have to change its permissions to read and write first, or use the ! option in vi to override.

vi /etc/sudoers

Add:

username    ALL=(ALL) ALL


Esc, ZZ and change the permissions on the file back to read-only.

Example:




User switcher


If, when you restart as your non-root user you get the message "OAFIID:GNOME_FastUserSwitchApplet panel encountered a problem" with an option to delete it, then do delete it. Do NOT install indicator-applet-session instead as suggested on many forums. It will install ubuntu one shit. Muhhhhahahahaaa. I have to go and reinstall Backtrack now.


Deleting user


Code:

deluser [options] [--force] [--remove-home] [--remove-all-files]
       [--backup] [--backup-to DIR] username

Example: deluser lilith


More with man


To learn more about either type the command:

man adduser

man deluser

man usermod

You can get out of man with q

2 comments:

  1. Hi ..
    I followed ur advice.
    now when i log in as unpriviledged user WICD does not respond, it asks me to add the new user to netdev group.
    which i did using "usermod --groups netdev "
    but even this did not help.

    any advice ?

    ReplyDelete
  2. for this, vi /etc/sudoers "vi" you change "gedit"
    use account root.....

    ReplyDelete