PuTTY sFTP Transfer

I am in PuTTY and PSFTP on Windows and am connected to my remote server which is an Ubuntu.

My problem is selecting a file to upload to the remote server using the put command.

In the same directory as the PSFTP executable, I have a folder called "CSS".

I try psftp> put CSS and I get local: unable to open CSS even though I see it on the list of available directories using !dir.

Furthermore, when I select another file that does work, I get the following error:

open for write: permission denied

How do I solve these two problems, firstly the not being able to select the directory I want to upload, the second the permission denied error?

Thank you very much.

2 Answers

In psftp, if you type help put, you will see the following:

put [ -r ] [ -- ] <filename> [ <remote-filename> ] Uploads a file to the server and stores it there under the same name, or under a different one if you supply the argument <remote-filename>. If -r specified, recursively store a directory.

Use put -r CSS, instead, to transfer a directory. You will get an error message such as local: unable to open CSS, if you try to use the put command to transfer a directory without using the -r option.

As an aside, another good, free program for sftp for Microsoft Windows systems is WinSCP.

On the Ubuntu system check the permissions on the directory where you are attempting to place the files with ls -ld directory_name. E.g., supposing you are trying to put the files in a directory called test:

$ ls -ld test
drwxrwxr-x. 3 jdoe jdoe 61 Feb 14 10:42 test

The directory above is owned by the jdoe account and the group is also jdoe. So, if you logged into the Ubuntu system with psftp using the jdoe account, you would be able to place the files in the test directory because the owner account for the directory has read, write, and execute permissions (the first rwx characters after the "d" indicating test is a directory. Any account in the jdoe group also has read, write, and execute access, the "x" also grants the ability to search or see files in the directory. The last 3 permissions characters are r-x granting other accounts on the system read and execute permissions, i.e., the ability to search the directory or see the files within it, but not write permission, i.e., the ability to modify existing files within the directory or place new ones there. If you wanted to grant every account on the system read, write, and execute permissions, you could use chmod 777 test or chmod o+w test which adds write permission for "other" accounts to test. But be sure there aren't any security concerns regarding allowing any accounts on the Ubuntu system the ability to place files in the directory or modify existing ones. Alternatively, if you logged into the account that owns the directory with psftp, e.g., the jdoe account, you don't have to change the permissions.

You can also see the permissions from within psftp after you log into the Ubuntu system using it. Just type ls while you have a directory above the one where you want to store the files selected then look for the permissions on the directory within which you want to store the files.

I would expect the error messages you reported if, for instance, you were trying to place files in a directory owned by root to which other accounts don't have write access.

4

Alternatively, you could download a program called Filezilla. I use this at my job, it allows you to literally drag and drop files into the directory you want. It's useful when you don't want to have to use the terminal just to do a trivial task.

It connects to the server via SSH.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like