Pack folder and backup database
Backup folder. Run as sudo, other users will change the original permissionstar -zcf wp03.tar.gz wp03/Backup database
mysqldump -u root -p -C albert > albert.sql.tgz
Create user with home folder, shell & password
sudo useradd -m -d /home/mike -s /bin/bash -c "Mike" -U mike sudo passwd mike Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Numeric permissions in console
$ ls -la | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf("%0o ",k);print}'
775 drwxrwxr-x 9 3173 3173 4096 Oct 12 20:01 .
755 drwxr-xr-x 4 3173 3173 4096 Oct 12 21:54 ..
755 drwxr-xr-x 6 3173 3173 4096 Oct 12 19:08 app
755 drwxr-xr-x 2 3173 3173 4096 Oct 9 15:46 bin
644 -rw-r--r-- 1 3173 3173 2111 Mar 11 2017 composer.json
664 -rw-rw-r-- 1 3173 3173 102342 Oct 12 19:08 composer.lock
Search file names and file content
find file that begins with example case insensitive searchfind . -iname "example*" -print
finds string `getcol` in js files in current folder and it`s subfolders, print file name, line number and the line
find . -type f -name "*.js" -exec grep -in --with-filename getcol {} \;
Set permissions for files and folders
sudo find /var/www -type d -exec chmod 775 {} \; # rwxrwxr-x sudo find /var/www -type f -exec chmod 664 {} \; # rw-rw-r--
No comments:
Post a Comment