SaltyCrane Blog — Notes on JavaScript and web development

Notes on users and groups on Linux

Here are some notes on some basic tasks dealing with users, groups, and permissions on Ubuntu Linux. All these commands (except passwd) are done as root. If you are not root, prepend sudo to all the commands.

  • Add a user, sofeng
    # adduser sofeng
  • Change your password:
    $ passwd
  • Create a developer group
    # addgroup developer
  • Add user sofeng to the developer group
    # adduser sofeng developer
  • Give developer group sudo power:
    Add the following line to /etc/sudoers:
    %developer ALL=(ALL) ALL
  • Change owner to sofeng, and group to developer, of directory, mydir, and all its subdirectories:
    # chown -R sofeng:developer mydir
  • Change permisions of directory, mydir, and all its subdirectories, to be writable by the group, developer:
    # chmod -R g+w mydir