Unix/Linux
Handy Commands
- For commands are great eg for d in `ls`; do sudo cp .htaccess $d/.htaccess; done
- Adding a date to a file name eg ls > files-`date +%Y%m%d-%H%M%S`.txt
- Running several commands in one sudo eg sudo sh -c ‘/usr/local/src/backup.sh > /var/log/backup.log’
- lsusb list usb devices & show vendor info
Great Guides
Protecting Wordpress
Shell User Setup
- Add the user, adduser newuser
- Create the web dir, mkdir /var/www/newuserdomain
- Grant the user rights on the domain, chown -R newuser:newuser /var/www/newuserdomain
- Copy the site template, cp /etc/apache2/sites-available/inetd.info /etc/apache2/sites-available/newdomain
- Edit the new file changing the domain name with vi, :%s/inetd.info/newdomain/g
- Create the log file directory, mkdir /var/www/newdomain/log/
- Link the available to file to enabled, ln -s /etc/apache2/sites-available/newdomain /etc/apache2/sites-enabled/nnn-newdomain
- Reload apache config, /etc/init.d/apache2 reload
- Let the user login via ssh, vi /etc/ssh/sshd_config
- Reload sshd, /etc/init.d/ssh reload