After a lot of use, your history file can become full of a lot of old commands… once in a while, it can be useful (and safer) to clean them up.
NOTE: this can be especially important if you have ever used a password as a command line parameter as it is stored without encryption in a text file.
cat /dev/null > ~/.bash_history && history -c && exit
This is a relatively trivial topic, but comes up quite often. For securing content on a server, you’ll often want to password protect entire domains or paths. Add the following to the correct block in your httpd.conf and you should be ready to go.
If you have a complex environment, you may want to consider having individual password files for each asset.
AuthName "Restricted Files"
To create/clobber a new file for the first user:
sudo htpasswd -c /etc/apache2/.htpasswd YOURUSER
To add additional users:
sudo htpasswd /etc/apache2/.htpasswd YOURUSER
(repeat for new users without the -c as that creates/clobbers the file)
When setting up a new JBoss environment, or maintaining an older one you often need to set or reset admin passwords. You can find them here…
Installing MySQL on Ubuntu requires only a few simple steps.
sudo apt-get install mysql-server
sudo netstat -tap | grep mysql
sudo vi /etc/mysql/my.cnf
sudo service mysql restart
To look for some simple performance and security suggestions:
sudo apt-get install mysqltuner
Adding a new user is equally easy…
mysql --user=root --password=mypassword mysql
CREATE USER 'myusername'@'%' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON *.* TO 'mydatabase'@'%' WITH GRANT OPTION;
NOTE: This allows access to the user from ALL hosts, it can be limited by replacing the
'%' with a specific hostname (such as ‘localhost’ if desired) for security.