Category Archives: Ubuntu 15.10

Back UP A MySQL Database In Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

MySQL databases are often used to power web applications such as WordPress or Moodle, which means that those MySQL databases often wind up holding vital information. Therefore, it is important to back them up on a regular basis. A quick and easy way to backup a MySQL database is with the mysqldump command-line tool. This tool downloads the database into a single SQL file, which you can store as a backup or use to transfer the database to another MySQL server.

To use mysqldump, you will need to know the root password of the MySQL server (or a user with permissions to the database you need to download).

In this example, we will dump a database named data into a file named data.sql:

mysqldump -u root -p data > data.sql

Enter the root password, and mysqldump will dump the database information into the data.sql file.

To transfer the database to a new server, first create a blank database on the server from the MySQL command prompt. In this example, this command will create a new database named datanew:

CREATE DATABASE datanew;

Then transfer the data.sql file to the new server and write it onto the new database with this command:

mysql -u root -p datanew < data.sql

The datanew database will receive all the tables and columns contained in the data.sql file. Note that this command completely overwrites the target database with the information in the SQL file, so make sure to select the correct database!

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install MySQL Server On Ubuntu 15.10

Ubuntu1510Terminal

To install MySQL Server on Ubuntu, make your way to a Terminal window or a command prompt, and type this command:

sudo apt-get install mysql-server-5.6

(As of this writing, MySQL Server version 5.6 is the latest version available in the Ubuntu repositories, though future versions of Ubuntu may receive the newer versions of MySQL.)

Enter your password to authenticate, and apt will download the MySQL files and install them for you. It’s a big set of files, so depending on the speed of your Internet connection, it might take a while to download. After the files are downloaded and are installing, the installer will ask you for a password for MySQL’s root user. Just as the root user in Linux has complete control over the system, the root user in MySQL has absolute control over all databases, tables, permissions, and users. For obvious security reasons, you’ll want to create an extremely strong password (a mixture of uppercase, lowercase, numbers, and punctuation, the longer the better) for your MySQL root user.

(Note that in the password dialog box, if you can’t get the <OK> field selected, you can use the tab key to jump from the text input line to the <OK> field.)

After you enter the root password, the installer will finish working with the MySQL files, and return you to the command line. You’ll then need to activate MySQL with the following command:

sudo mysql_install_db

This will set up MySQL Server for use with your Ubuntu system. Next, you’ll want to run the mysql_secure_installation script to tighten up security on your new MySQL server. Run this command from the prompt:

sudo mysql_secure_installation

First, the mysql_secure_installation script will ask you to enter the current password for the MySQL root user. After you do that, it will ask if you want to change the root password. Since you already set a root password, you can hit “n” (unless you want to change it again for some reason).

Next, the script will ask if you want to remove the anonymous user. The anonymous user, like anonymous access in FTP, lets someone log into MySQL without having a proper user account. For security reasons, it’s always best to remove the anonymous user, so hit “y” to continue.

After that, the script will ask if you want to prevent the MySQL root user from logging in remotely to the MySQL server. Always hit “y” to forbid root remote access, since if an attacker guesses your root password, he can destroy your databases or steal the information they contain.

After this, the script will ask if you want to remove the test database. MySQL includes a test database that anyone can access. Again, this is a security hole, so you’ll want to hit “y” to remove the test database.

The script will then ask to reload the privilege tables so the changes take effect. Hit “y”, and the mysql_secure_installation script will conclude and return you to the command line.

MySQL server is now installed on your Ubuntu system.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Configure Apache Virtual Hosts On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

It is easy to set up a simple web server with Apache. However, you might need a more complex web server, one that can host multiple separate websites, rather than subdirectories within a larger website.

How do you do this?

Apache has a feature called “virtual hosts” that lets you run separate websites, with completely different domain names, on the same physical server. Fortunately, implementing virtual hosts for Apache is actually quite simple to do. In this example, we’ll show you how to set up a new website called “examplename.com” on an Apache web server.

First, you’ll need to set a location for your new web site’s files. Apache, you might recall, by default stores the web files in /var/www. For this example, create a new folder for the website with this command:

sudo mkdir /var/w2

Next, you’ll need to create a configuration file for the new website in the /etc/apache2/sites-available directory. Fortunately, that directory contains a default file you can simply copy and use as a template with this command:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/examplename

The next step is to edit the new configuration file with the correct settings. You can do this using the vi text editor:

sudo vi /etc/apache2/sites-available/examplename

Once editing the file with vi, you’ll need to make a few changes.

Change the “Document Root” directive from /var/www to the proper location of your new website, in this case, /var/w2.

Also change the “Directory” directive from /var/www to /var/w2.

Finally, under the line that begins “ServerAdmin”, add a new line for the new website’s domain name. For our website named “examplename.com”, add a line like this:

ServerName examplename.com

Save changes to the configuration file, and then exit vi.

Now you’ll need to modify Apache to display the new domain names to web visitors. Fortunately, you can do this with the a2ensite command:

sudo a2ensite examplename

(Note that “examplename” would change depending upon what you named your configuration file.)

One final step – restart Apache to force it to re-read its configuration files and start serving the new website:

sudo /etc/init/d apache2 restart

Make sure you have some sort of index.html file in /var/w2, and the examplename.com website should now be working.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install Apache Web Server On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

To install Apache, type this command at a Terminal window or a command prompt:

sudo apt-get install apache2



(Technically, you’ll be installing Apache 2, the latest version.)

Enter your password to authenticate, follow the default prompts, and apt will download and install the Apache web server for you.

And that’s it! Apache should now be working. To test it from the web server itself, go to a web browser and visit the address http://127.0.0.1. This is the “local loopback” address, basically the IP address the local computer uses to refer to itself. Alternatively, you could test it from another computer on the same subnet. For instance, if you installed Apache on a computer with an IP address of 192.168.1.100, you could test it by going to another computer on the same subnet and visiting http://192.168.100 from the web browser.

Regardless, if Apache is working properly, you should see a web page with only two words on it:

It works!

Apache is now operational.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install ffmpeg For Media Conversion On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

From time to time you may need to extract the sound from a video file. Fortunately, using the ffmpeg program, it’s quite simple to take the sound from any video file and store it as a separate file. The ffmpeg utility can convert back and forth between multiple formats of both video and sound. Even better, in keeping with the overall theme of this book, ffmpeg is a command-line utility.

Here’s how to install and use ffmpeg on Ubuntu.

First, you’ll need to install the Ubuntu Restricted Extras package.

After you’ve installed the Ubuntu Restricted Extras, use this command to install ffmpeg:

sudo apt-get install ffmpeg



After the installation is complete, you can use ffmpeg to extract the audio from a video file. Say, for example, you have a video file named test.avi. To extract the audio to a file named audio.mp3, use ffmpeg with these options and arguments:

ffmpeg -i test.avi audio.mp3

This will create an audio file named audio.mp3 containing the sound from the video file. However, by default ffmpeg creates audio files with a bitrate of 64 kbps, which results in very low-quality audio. To force ffmpeg to create the mp3 file at the 256 kbps bitrate, add the -ab option to the command:

ffmpeg -i test.avi -ab 256k audio.mp3

This will create a higher-quality mp3 file, and you can use this modified command to extract the audio from any compatible video file.

The ffmpeg utility can do many other conversions as well – be sure to read the entire manual page for ffmpeg with this command:

man ffmpeg

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install The GIMP Image Manipulation Program On Ubuntu 15.10 Wily Werewolf

GIMP

Beginning with Ubuntu 10.04 Lucid Lynx, Ubuntu no longer came with the GNU Image Manipulation Tool (the GIMP), and Ubuntu 15.10 Wily Werewolf follows in its predecessor’s footsteps.

This makes some sense; the GIMP is rather more image editing capability than your average user needs. However, some users need the GIMP for their workflows. Fortunately, the packages are readily available in the Ubuntu repositories, and it’s trivially easy to install the GIMP. Simply go to the Terminal and issue this command:

sudo apt-get install gimp

Enter your password to authenticate when prompted, and apt-get will download and install the GIMP for you.

When the installation is complete, you can launch the GIMP by going to the Dash, searching for “GIMP, and click on the application’s icon.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Split And Merge PDF Documents With pdftk On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

PDF stands for Portable Document Format, and has become the de facto standard for official government documents and corporate documents – think of how many times you have had to visit a government website or your employer’s website to download and fill out an official form in PDF. The upside to this is that a document creator can arrange to have a PDF look exactly the way he wants it, since PDFs are readable on many different operating systems and devices. The downside is that if you need to change a PDF file after it has been created, changing it is both annoying and difficult.

The is where the pdftk utility comes into play. The pdftk utility (it’s short for “PDF Toolkit”) allows you to combine and separate PDF files. It’s not included in the default installation of Ubuntu, but you can rectify that in short order from the command line. Log into an account with administrative rights, go to a Terminal window, and type this command:

sudo apt-get install pdftk

Enter your password to authenticate, and apt will download and install pdftk for you. After the installation is complete, you can use pdftk from the command line.

Now that you have pdftk installed, we’ll show you how to use it combine PDF files. Let’s say, for example, that you have three PDF files: Page1.pdf, Page2.pdf, and Page3.pdf. You need to combine them into a single PDF document called FinalDraft.pdf. You could do this via LibreOffice or another document editing program. Or you could do it with pdftk:

pdftk Page1.pdf Page2.pdf Page3.pdf output FinalDraft.pdf

This command will take the three PDF files and combine them into a single PDF named FinalDraft.pdf. Note that pdftk will combine the files in the order they are listed. So if you wanted Page3.pdf to actually be the first page in FinalDraft.pdf instead of Page1.pdf, you would use this command:

pdftk Page3.pdf Page2.pdf Page1.pdf output FinalDraft.pdf

This will create the FinalDraft.pdf document with the Page3.pdf as its first page.

You can also use pdftk to extract single pages from larger PDF documents. In this example, let’s say you have a 90-page PDF document named Report.pdf. You want to extract only page 9 from this document so you can email it to a coworker. To extract page 9 from Report.pdf and save it as its own PDF document named Page9.pdf, use pdftk with these options:

pdftk A=Report.pdf cat A9 output Page9.pdf

This will take the ninth page from Report.pdf and save it as its own PDF document named Page9.pdf.

Likewise, you can also use pdftk to extract a range of pages from a PDF document and save them in their own file. To return to our previous example, if you wanted to extract pages 19 through 37 of Report.pdf in their own file named Extract.pdf, you would use pdftk with these options:

pdftk A=Report.pdf cat A19-37 output Extract.pdf

With pdftk, you can disassemble and reassemble PDF documents with ease.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install And Configure WordPress On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

First, install Ubuntu into your machine of choice. Once Ubuntu is installed and updated, you will need to install five pieces of software: the Apache web server, the MySQL database server version 5.5, PHP version 5, the MySQL module for PHP, and finally the WordPress software itself.

First, install the Apache web server. To install Apache, go to a Terminal window or a command prompt and type this command:

sudo apt-get install apache2

(Technically, you’ll be installing Apache 2, the latest version.)

Enter your password to authenticate, follow the default prompts, and apt will download and install the Apache web server for you.

And that’s it! Apache should now be working. To test it from the web server itself, go to a web browser and visit the address http://127.0.0.1. You’ll remember that this is the “local loopback” address, basically the address the computer uses to refer to itself. Alternatively, you could test it from another computer on the same subnet. For instance, if you installed Apache on a computer with an IP address of 192.168.1.100, you could test it by going to another computer on the same subnet and visiting http://192.168.100 from the web browser.

Regardless, if Apache is working properly, you should see a web page with only two words on it:

It works!

Apache is now operational.

The next step to install WordPress is to install the MySQL database server. Return to the Terminal and type this command:

sudo apt-get install mysql-server-5.6

(As of this writing, MySQL Server version 5.6 is the latest version available in the Ubuntu repositories, though future versions of Ubuntu may receive the newer versions of MySQL.)

Enter your password to authenticate, and apt will download the MySQL files and install them for you. It’s a big set of files, so depending on the speed of your Internet connection, it might take a while to download. After the files are downloaded and are installing, the installer will ask you for a password for MySQL’s root user. Just like the root user in Linux, the root user in MySQL has absolute control over all databases, tables, permissions, and users. For obvious security reasons, you’ll want to create an extremely strong password (a mixture of uppercase, lowercase, numbers, and punctuation, the longer the better) for your MySQL root user.

(Note that in the password dialog box, you can’t get the <OK> field selected, you can use the tab key to jump from the text input line to the <OK> field.)

After you enter the root password, the installer will finish working with the MySQL files, and return you to the command line. You’ll then need to activate MySQL with the following command:

sudo mysql_install_db

This will set up MySQL Server for use with your Ubuntu system. Next, you’ll want to run the mysql_secure_installation script to tighten up security on your new MySQL server. Run this command from the prompt:

sudo mysql_secure_installation

First, the mysql_secure_installation script will ask you to enter the current password for the MySQL root user. After you do that, it will ask if you want to change the root password. Since you already set a root password, you can hit “n” (unless you want to change it again for some reason).

Next, the script will ask if you want to remove the anonymous user. The anonymous user, like anonymous access in FTP, lets someone log into MySQL without having a proper user account. For security reasons, it’s always best to remove the anonymous user, so hit “y” to continue.

After that, the script will ask if you want to prevent the MySQL root user from logging in remotely to the MySQL server. Always hit “y” to forbid root remote access, since if an attacker guesses your root password, he can destroy your databases or steal the information they contain.

After this, the script will ask if you want to remove the test database. MySQL includes a test database that anyone can access. Again, this is a security hole, so you’ll want to hit “y” to remove the test database.

The script will then ask to reload the privilege tables so the changes take effect. Hit “y”, and the mysql_secure_installation script will conclude and return you to the command line.

MySQL server is now installed on your Ubuntu system.

The next step to installing WordPress is to install PHP version 5:

sudo apt-get install php5

Then install the MySQL module for PHP:

sudo apt-get install php5-mysql

You may also want to install the GD library for PHP, since many WordPress plugins rely on it for graphical manipulation (note that this is an optional step):

sudo apt-get install php5-gd

Finally, download the WordPress software to your computer. You can obtain it from this address:

http://wordpress.org/latest.tar.gz

If you’re working exclusively from the command line, you can use this command to download the WordPress software:

wget http://wordpress.org/latest.tar.gz

Use this command to unpack the WordPress files:

tar -xzvf latest.tar.gz

Make a directory in /var/www for the WordPress files:

sudo mkdir /var/www/html/wordpress

Finally, move the WordPress files over to the /var/www/wordpress directory. (In this command, I’ll assume you unpacked the WordPress files to your home directory; you will have to adjust the command if you unpacked them in a different directory.)

sudo cp -r ~/wordpress/* /var/www/html/wordpress

Now that we’ve got our software installed and downloaded, we’ll need to configure it. We’ll start with Apache.

First, it’s always a good idea to make a backup of a system configuration file before you alter it, so start by making a backup of Apache’s configuration file. Use this command to back up Apache’s configuration file to your home directory:

cp /etc/apache2/apache2.conf ~

Next, you’ll need to add a line to your /etc/apache2/apache2.conf file, so Apache will properly interpret WordPress’s PHP files. (Note that this is only necessary if you install WordPress in a subdirectory of /var/www, as we are doing in this example. If you install WordPress in /var/www, you don’t need to add this line, but you do need to delete or move the original index.html file.) To edit apache2.conf, fire up the vi editor:

sudo vi /etc/apache2/apache2.conf

Once you are in vi, scroll to the end of the file, switch to Insert mode, and add the following line (note that there is a space between the final “p” of “php” and the period before “html”):

AddType application/x-httpd-php .html

Return vi to Command mode, save the file, and then exit vi. Restart Apache with this command, so it re-reads its configuration file:

sudo /etc/init.d/apache2 restart

Now we’ll need to prepare MySQL for use with WordPress. WordPress requires a database and a database user, and full permission for its database user to access its database. To start the MySQL command-line client, use this command:

mysql -u root -p

Enter the password for the MySQL root user, and you’ll find yourself at the MySQL command prompt, which will look like this:

mysql>

Our next steps are to create a WordPress database, create a user to access that database, and grant our new user all rights to the WordPress database.

(An important note before we continue, though. All commands made from the MySQL prompt must end with a semicolon to denote the end of the statement. Any commands that do not end with a semicolon will not work. With that in mind, let’s first create a database.)

To create a database for WordPress, use this command at the mysql> prompt:

CREATE DATABASE wordpress;

The MySQL client will respond with a message that should say “Query OK, 1 row affect (0.00 sec).” This means the command was successful, and a new database named “newdatabase” has been created.

Next, you’ll create a user who will access that database:

CREATE USER wordpressuser;

You should get the “Query OK” message again. Once the new user is created, we’ll need to set a password for the user before we can assign any permissions. In this example, we’ll assign a password of “1234”. However, in real life, just as with the root user, you’ll want to assign a strong password. (This database user won’t have full control over the MySQL user as the root user does, but we will give it full control over the database we just created, and a malicious user who guesses the password could cause all kinds of trouble.) To create the password, use this command:

SET PASSWORD FOR wordpressuser= PASSWORD(“1234”);

Again you should get the “Query OK” confirmation message. The final step is to assign all privileges on the “wordpress” database to the “wordpressuser” user. Use this command to assign the permissions:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY ‘1234′;

That isn’t a typo – those are single quote marks (‘) instead of the usual double quote marks (“) that were used in the command to set the password. MySQL’s internal syntax, alas, isn’t always consistent. Anyway, if you typed the command correctly, you should get the “Query OK” confirmation again.

Once you are done, use this command to quit the MySQL command-line interface:

exit

Then type exit to quit the MySQL local command-line client. Now that we have MySQL prepared, we can now configure WordPress itself. Specifically, we’ll have to configure WordPress to talk to the database we just created. To do so, you must create a wp-config.php file in the WordPress directory. Fortunately, WordPress includes a handy wp-config-sample.php you can use as a template.

Type this command to create a wp-config file (assuming you installed WordPress in the www/wordpress directory):

sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Next, use vi to edit the newly created wp-config file:

sudo vi /var/www/html/wordpress/wp-config.php

You’ll see that the wp-config.php file contains a number of variables. Change the following three variables:

-Change putyourdbnamehere to wordpress.

-Change usernamehere to wordpressuser.

-Change yourpassword here to 1234.

Once you have your changes made (after double-checking the spelling, of course), switch vi to Command mode, and save your changed file.

Everything should now be ready. Open up a web browser, and navigate to http://ifconfi127.0.0.1/wordpress. (If you want to access it from a different machine, of course, use the IP address of the WordPress server, for instance – http://192.168.1.100/wordpress ) If you configured everything correctly, you should then be greeted by the WordPress configuration page. You’ll pick a username, and WordPress will assign you a password. Follow the prompts, and you will have a functional WordPress blog installed on a Ubuntu machine. Congratulations!

One final note: if you configure your blog from a local browser, it will probably set your blog’s address as http://127.0.0.1/wordpress. This is fine if you only want to view it from the host machine, but if you want to view it over the network, you’ll need to change it. Fortunately, you can do so quickly by going Options in the WordPress admin interface, and then to General, and changing the blog’s URL.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install VLC Media Player On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

VLC Media Player is a handy program that can play numerous forms of video, and runs on just about any OS platform. It also runs on Ubuntu 15.10 Wily Werewolf and installing it is quite simple.

Before you install VLC, you will likely want to install the Ubuntu Restricted Extras package in order to add the necessary multimedia codecs to your system. Directions for installing the Ubuntu Restricted Extras package are here.

To install VLC itself, first open up a Terminal window and type this command:

sudo apt-get install vlc

Enter your password to authenticate, and apt will download and install VLC and its various dependencies for you. (You can also install it through Synaptic Package Manager and Ubuntu Software Center.) Afterwards you can launch VLC by going to the Dash and searching for VLC.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Configure OpenSSH Server To Use Key-Based Authentication In Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

SSH is pretty secure, but it does have one weak link – the password. If someone cracks your SSH password, they can gain control over your SSH server.

A more secure method of SSH logons is to use a public/private key. With a public/private key, you create a matched pair of private and public keys. You keep the private key on your personal machine, while you put the public key on the SSH server to which you wish to connect. When configured in this manner, the SSH server will only allow connections from systems that have a matching private key for one of the public keys.

In this section, we’ll show you how to set up key-based logons for SSH.

First, install OpenSSH server on your server. For the rest of this walkthrough, we’ll assume that you installed the SSH server on a machine with the IP address of 192.168.1.100, and that you intend to connect to that server from a client machine with the IP address of 192.168.1.200.

After SSH server has been installed, go to your client machine at 192.168.1.200 and enter this command:

ssh-keygen -t dsa


Press Enter, and the command will save a matched public/private key in the ~/.sshdirectory. Specifically, it creates two files – id_dsa, which is your private key, andid_dsa.pub, which is your public key. It will also ask you to set a passphrase for the use of the key, which is an additional layer of security in case someone gains access to your account. Setting a passphrase is usually a good idea.

After the command is complete, you’ll need to transfer the newly created id_dsa.pubpublic key file to your SSH server at 192.168.1.100. Once you have moved it to your server, copy the file to your user account’s ~/.ssh directory on the server. (If this directory does not already exist, create it with the mkdir command.) Next, change to the~/.ssh directory, and use this command:

touch authorized_keys

This will create a file to store authorized keys in the ~/.ssh directory. Use this command to add your public key to the authorized_keys file:

cat id_dsa.pub >> authorized_keys

Finally, use the chmod command to make authorized_keys read-only to protect from accidental deletion:

chmod 400 authorized_keys

Finally, you’ll need to alter your SSH server’s configuration file to mandate key-based logins, otherwise the server will continue to allow password-based login. Use the vi editor to edit SSH’s main configuration file:

sudo vi /etc/ssh/sshd_config

Once editing the file, make sure the PasswordAuthentication directive is set to no. This will force your SSH server to only allow key-based login attempts. After you’ve finished editing the file, restart your SSH server with this command:

sudo service ssh restart

Your SSH server will not only permit key-based logons – users must have a private key that matches with a corresponding public key in their ~/.ssh/authorized_keys file in their home folder on the SSH server.

Make sure to back up your private key in a safe place – if you lose it, you will lose access to the SSH server.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide