As the system administrator for your Linode, you may want to give your users the ability to securely upload files to your server. The most common way to do this is to allow file transfers via Secure File Transfer Protocol (SFTP), which uses SSH to provide encryption. This requires that you give your users SSH logins. However, by default SSH users are able to view your Linode’s entire filesystem, which may not be desirable.

This guide will help you configure OpenSSH to restrict users to their home directories, and to SFTP access only. Please note that these instructions are not intended to support shell logins; any user accounts modified in accordance with this guide will have the ability to transfer files, but not the ability to log into a remote shell session.

These instructions will work for Ubuntu 9.04, Debian 5, and later. Unfortunately, the version of SSH packaged with Ubuntu 8.04 is too old to support this configuration.

Modify User Accounts

This section will set up the correct groups, ownership, and permissions for your user accounts.

Create a system group for users whom you want to restrict to SFTP access:

addgroup --system filetransfer

Modify the user accounts that you wish to restrict to SFTP. Issue the following commands for each account, substituting the appropriate username. Please keep in mind that this will prevent these users from being able to log into a remote shell session.

Your users should now be able to log into their accounts via SFTP and transfer files to and from their assigned subdirectories, but they shouldn’t be able to see the rest of your Linode’s filesystem.

Use SFTP

Use sftp from the terminal:

sftp username@<Your_Linodes_IP>

You can use the help command to see what commands you have access too within the SFTP shell. You have the ability to pwd, cd and ls, for instance. There are also commands like lpwd, that will print the local working directory. In the local home directory type touch test.txt

Transfer local files to the remote system:

cd docs
put test.txt

Transfer files to the local system from the remote system:

get test.txt

You can test the file permissions by navigating to a different directory within the SFTP shell, and trying to transfer a file.

Here are some of the more frequently used commands that I find useful.

—

To search for a particular package by name or description:
From the command-line, use:

apt-cache search keyword

—

The apt tool on Ubuntu 14.04 and above makes this very easy.

apt list --installed

—

Check available version of a package in Ubuntu repositories from command line:
apt-cache policy

—

You may wonder if the given package is installed or not. It’s easy to find out too.

In the above output, you see two words namely Installed and Candidate.

Installed : This will tell you the version that you have currently installed in your Ubuntu system.
Candidate : This is actual version that will be installed from the Ubuntu repositories when you install the package using apt-get.

—

If your system is in state where apt-get is mostly unusable you could try using dpkg to remove the affected package, in this case try:

NOTE: Make sure you know/trust the server you are communicating with in the first place

Sometimes, git servers can have issues with TLS or other secure handshaking procedures. This is often due to connecting from an older linux/ubuntu box. If you are truly desperate and don’t have time to fix the SSL/TLS properly, here is a very quick fix:

Assuming that cell B2 contains a name like, Dangerfield, Rodney, here are 2 formulas you can use to create 2 cells, one with the first name, one with the last name.

For the first name:=RIGHT(B2,LEN(B2)-FIND(",",B2)-1)

and for the last name:=LEFT(B2,FIND(",",B2)-1)

Next, copy those formulas down thru all apllicable rows.

Lastly, highlight the 2 columsn, right-click and choose Copy.
Then right-click on an empty column head to the right, and choose: Paste Values.

Special Case

What if the name is really, “last_name, first_name middle_name”, and you don’t want the middle name?=LEFT(RIGHT(B2,LEN(B2)-FIND(",",B2)-1),FIND(" ",RIGHT(B2,LEN(B2)-FIND(",",B2)-2)))

That’s great, but what if someone does NOT have a middle name?
Then you’ll get an error.
To solve for that, need to make it even fancier:=IF(ISERROR(LEFT(RIGHT(B2,LEN(B2)-FIND(",",B2)-1),FIND(" ",RIGHT(B2,LEN(B2)-FIND(",",B2)-2)))),RIGHT(B2,LEN(B2)-FIND(",",B2)-1),LEFT(RIGHT(B2,LEN(B2)-FIND(",",B2)-1),FIND(" ",RIGHT(B2,LEN(B2)-FIND(",",B2)-2))))