How to check which version of Ubuntu you’re running

Type the following in a terminal window and type lsb_release -a

The output should look something like this:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise

Posted in Ubuntu | Tagged , | Leave a comment

How to enable or disable shell access for a Linux user account

To disable shell access use the following command (replace username with the correct values for your situation – leave out the curly brackets).

chsh -s /sbin/nologin {username} or chsh - /usr/sbin/nologin {username}

To grant bash access use:

chsh -s /bin/bash {username}

Posted in FAQ | Tagged , , | Leave a comment

How to set SSH to run on a non-standard port

By default, the OpenSSH server runs on TCP port 22. Changing this to a non-standard port helps mitigate the risk of someone successfully gaining access via a brute force attack, especially if there are many users on the system or if someone users use less secure authentication options. Don’t forget to open the port in your firewall to avoid being locked out.

Edit the SSH config file using the following command:

nano /etc/ssh/sshd_config

Change the line:

Port 22 to whatever number you wish.

It’s important that you don’t set SSH to run on a port that is reserved for another protocol / service. Wikipedia has a list of known ports that may be helpful in this regard: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

Posted in FAQ | Tagged , , | Leave a comment

How to Import / Export MySQL Databases via SSH / Command-line

To Export a MySQL Database run:

mysqldump -u username -p database_name > dumpfile.sql

To Import a MySQL Database run:

mysql -u username -p database_name < dumpfile.sql

Posted in FAQ | Tagged , , | Leave a comment