Linux Permissions
Linux Permissions
ls-la
: Shows permissions on directories
Groups: a group of users
sudo usermod -a -G groupname username
Add a user to a group
sudo chown -R username:group .
Change owner to a group to all directories and files in this directory
sudo pip3 install --update pip
pip3 install docker-compose
sudo apt remove golang-docker-credential-helpers
I don't know what this does. Error with docker credentials
Creating a new user on Linux server
To create a new user on a Linux server first log into the server and make sure you have sudo privileges. If you do the next command you'll enter is:
## substitute chosen username for <username>
sudo useradd <username>
This will create a new user with the chosen username. Next add the password
sudo passwd <username>
You will be prompted to enter in a password, and then prompted to re-enter.
Next is to set up a home directory for the user. This is sometimes done automatically but usually not. To create one manually enter:
sudo mkhomedir_helper <username>
Next, make sure the user is the owner of that directory by navigating to home and typing ls -la
. A list of directories and their owners should appear. If there are any groups that the new user should be a part of (i.e sudo) you should do this now. You can add users to groups by typing:
sudo usermod -a -G <groupname> <username>
Troubleshooting...
If the user logs in but isn't directed to their home directory the problem may be their default shell is wrong. Run echo $SHELL
to view which shell you are currently in. Check which shells are available by running which bash
. To change the shell for the user type:
chsh -s <shell> <user>
## for instance
# chsh -s /bin/bash cidzikowski
The user will have to log out and then log back in to see changes.