Snippets Collections
# When using a number mask for permission representation there are only a few basic permissions

4: Read
2: Write
1: Execute

# Combined you get this table

+-----+---+--------------------------+
| rwx | 7 | Read, write and execute  |
| rw- | 6 | Read, write              |
| r-x | 5 | Read, and execute        |
| r-- | 4 | Read,                    |
| -wx | 3 | Write and execute        |
| -w- | 2 | Write                    |
| --x | 1 | Execute                  |
| --- | 0 | no permissions           |
+------------------------------------+
  
# The permissions for user, group and other are listet after each other when looking them up

+------------+------+-------+
| Permission | Octal| Field |
+------------+------+-------+
| rwx------  | 700  | User  |
| ---rwx---  | 070  | Group |
| ------rwx  | 007  | Other |
+------------+------+-------+
  
# This boils down to this
  
  +------------------------+-----------+
| chmod u=rwx,g=rwx,o=rx | chmod 775 | For world readable directories
|                        |           |   Members of group can change files
| chmod u=rwx,g=rx,o=    | chmod 750 | For group readable directories
|                        |           |   Members of group can change files
| chmod u=rwx,go=        | chmod 700 | For private direcories
+------------------------+-----------+
# Check if 'webmasters' group exist

cat /etc/group | grep webmasters

# Create 'webmasters' group

sudo addgroup webmasters

# Add users to 'webmasters' group

sudo usermod -a -G webmasters username

# Group assignment changes won't take effect
# until the users log out and back in.


# Change group owner of the directory to webmaster user

sudo chgrp -R webmasters /etc/nginx/
  
# Give write permission to the group

sudo chmod -R g+w /etc/nginx/
  
# Create file as different user

sudo -u username touch /etc/nginx/test.txt
# Create user with access only to specific directory

adduser --home /restricted/directory restricted_user

# Make user owner of directory and grant write access

chown restricted_user:user_group /restricted/directory
chmod 755 /restricted/directory
# ssh-copy-id takes care of adding your key in the right place

ssh-copy-id -i "user@hostname.example.com -p2222"

# If you don't use -i all of your public keys will be copied over.
# Also a alias for the host can be used if configured in your ssh config.

# You will be asked for the password and after that all should be taken care of.
star

Mon Jun 21 2021 20:45:00 GMT+0000 (UTC) https://www.grymoire.com/Unix/Permissions.html

#authentification #permissions
star

Mon Jun 21 2021 20:32:43 GMT+0000 (UTC) https://askubuntu.com/questions/488485/allowing-a-group-read-write-access-to-a-directory

#authentification #permissions
star

Mon Jun 21 2021 20:27:00 GMT+0000 (UTC) https://qastack.com.de/superuser/149404/to-create-an-ssh-user-who-only-has-permission-to-access-specific-folders

#authentification
star

Mon Jun 21 2021 10:21:52 GMT+0000 (UTC) https://askubuntu.com/a/265646

#ssh #server #authentification #network

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension