2

If I try and access my FTP server via the command line using (sudo) sftp 192.168.1.x/home/directory the terminal returns

sftp: 192.168.1.x/home/directory: Name or service not known

But if I enter sftp://192.168.1.x/home/directory into Nautilus the directory is accessible.

Why am I not able to access the ftp server with the command line?

I have been having problems with FTP and backing up my system since yesterday so I might be missing something obvious by now. Sorry if that is the case.

2 Answers2

1

According to man sftp:

 sftp [user@]host[:file ...]

So you need a colon : between the server name and path.

sftp 192.168.1.x:/home/directory

Or better still, use a tilde ~ for the home directory!

sftp 192.168.1.x:~/
N0rbert
  • 103,263
1

I finally discovered why the SFTP wasn't working in the command line, it was because somehow during the upgrade from 16.04 to 18.04 the bash shell had been removed from the user "directory". I found this out by looking at /etc/passwd and noticed that the entry for "directory" had /usr/bin/nologin next to it. I entered the following command to fiy the problem.

sudo usermod --shell /bin/bash directory