User Tools

Site Tools


infrastructure:unix

This is an old revision of the document!


Table of Contents

Unix

Shell

Execute command without keeping it in hostory:

  • Sometimes shell commands must be kept form history, e.g. when setting secrets to environment variables for configuring applications according to the Twelve-Factor-App.
  • Configure the shell to not record history when starting with a space: $ export HISTCONTROL=ignorespace
  • Execute the command with a secret with a leading space: $ export MY_PASSWORD=the-secret
  • Verified in Bash. The command will not be recorded in ~/.bash_history.

Permissions

Users

  • Set owner: $ chown myfolder myuser
  • Set owner and group: $ chown myowner:mygroup myfolder
  • Change password: $ passwd
  • List user's groups: $ groups somebody

Groups

  • Set group: $ chgrp mygroup myfolder
  • Set owner and group: $ chown myowner:mygroup myfolder
  • List group members: $ getent group some-group

ACL

  • Flag s: created folders and files inherit the group of the upper folder. $ chmod g+s file.txt
  • List permissions:
    • $ getfacl file.txt
    • $ ls -lV
  • Set specific group permissions:
    • $ setfacl -m u:somebody:rwx file.txt
    • $ setfacl -m g:some-group:rw file.txt
  • Set default group permissions:
    • $ setfacl -m default:g::rwx file.txt
    • $ setfacl -m default:g:some-group:r file.txt
  • Remove a group: $ setfacl -x g:some-group file.txt
infrastructure/unix.1591788029.txt.gz · Last modified: (external edit)