The SSH File Transfer Protocol (SFTP) provides secure file transfer functions using the same infrastructure used by the Secure Shell protocol. It can be seen as a secure replacement for FTP.

learn more… | top users | synonyms

22
votes
3answers
19k views

Restricting an SSH/SCP/SFTP user to a directory

Is there a simple way to restrict an SCP/SFTP user to a directory? All methods that I've come across require me to set a chroot jail up by copying binaries, but I don't think that should be necessary. ...
20
votes
5answers
32k views

Uploading directories with sftp?

I'm having some trouble uploading directories(which contain other directories a few levels deep) by sftp. I realize I could work around this by gzipping, but I don't see why that's necessary. Anyway, ...
15
votes
4answers
6k views

What's the difference between SFTP, SCP and FISH protocols?

I used to think SCP is a tool to copy files over SSH, and copying files over SSH is called SFTP, which is itself a synonym to FISH. But now as I was looking for a Total Commander plugin to do this in ...
13
votes
4answers
859 views

What is SSH - the protocol and what is ssh - the utility?

What is SSH - the protocol? What is ssh - the unix utility and how does it work? How is SSH protocol related to SFTP? What is sshd? Does the command su use ssh or sshd?
7
votes
2answers
1k views

How do I sftp to a server if the username contains @ symbol

I have to sftp to a server to a specific port but the username contains the @ symbol. suppose the user is "user@domain.com" and the ftp server is just "domain.com" I will end with sftp -oPort:8777 ...
7
votes
4answers
18k views

Using sftp to Transfer a Directory?

When I try to use sftp to transfer a directory containing files, I get an error message: skipping non-regular file directory_name The directory contains a couple of files and two subdirectories. ...
6
votes
1answer
2k views

how to set the sftp -s subsystem option in a configuration file

The sftp command supports a subsystem option (-s) which allows the remote user to select the remote sftp-server executable, and optionally upgrade to sudo in the process like so; sftp -s ...
6
votes
3answers
617 views

How to prevent “Last Login:” message from showing up when using sftp?

In Ubuntu GNU/Linux 12.04, I have a user johndoe that is part of an sftponly group, set up to sftp to a chroot jail using Subsystem sftp internal-sftp Match Group sftponly ChrootDirectory %h ...
5
votes
5answers
508 views

Sftp interface to Scp

I have a linux based router that doesn't have the SFTP server installed. More specifically, when I sftp user@ipaddress I get a sh: /user/libexec/sftp-server: not found error. My interest isn't trying ...
5
votes
4answers
9k views

How to send multiple commands to sftp using one line

The following command sends one command to sftp using one line: sftp -o PasswordAuthentication=no user@host" <<<"lcd /home" How to send multiple lines to sftp using one line. Is there a ...
5
votes
1answer
370 views

Why is it possible to leave CHROOT with this sftp config?

I'm trying to create the user lenny, that has read and write permissions in the folder /home/lenny/ and has no shell but only access via SFTP. I'm doing the following: useradd lenny mkdir /home/lenny ...
4
votes
1answer
21k views

How do I use sftp to get a directory and all its contents? [duplicate]

When I try to use the command get from sftp, I get the error saying that it is not a normal file. Is there a way around this?
4
votes
1answer
1k views

Does the SFTP server accept passwords at all?

I'm trying to connect to a sftp server via sftp USERNAME@SERVERNAME. Whatever I do, I get "Permission denied (publickey)." Googling doesn't help as everybody recommends switching to key-based ...
4
votes
2answers
4k views

How to make tar save the archive on a remote machine using sftp or ftp?

I would like to backup some of my very important data on a remote machine. Currently I'm just saving it to my local machine by using this command: tar -cvjf ~/backups/Backup.tar.bz2 ~/importantfiles/* ...
4
votes
2answers
5k views

Disable direct login for normal users (like oracle) in linux but allow scp and sftp?

Is it possible to disable direct login for normal users (like oracle) in linux but allow scp and sftp for that use?
4
votes
1answer
269 views

Provide sftp read/write access to folder and subfolders, restrict all else

I need to provide user access to Ubuntu 14.04 Server, only limited to certain folder. To enjoy the ssh security and not to open up new service and ports (ie, ftp), I'd like to stick with sftp. ...
4
votes
2answers
712 views

How to pipe a remote file to stdout over scp or sftp?

Using ssh, it is easy to print the contents of a file using ssh host 'cat file.txt' When ssh is disabled, and only SFTP is enabled, running the previous command gives the following error: ...
4
votes
2answers
934 views

Restrict password-less backup with SFTP

I need to perform backup of a server to my computer using Duplicity: duplicity /etc sftp://backup@my.dynamic.ip.address//home/backup Before this can be done, I need to allow password-less access by ...
4
votes
1answer
115 views

How do I share a mounted sftp drive?

My friend has a public server that he's given me read access to with SFTP. I've successully mounted it in Mint 17 with the command sshfs user-name@file-server:/location/I/want /mount/point/I/want -o ...
3
votes
1answer
1k views

Why does the filename contains question marks when I run a script on my remote machine?

I have a tiny script that simply fetches the current date, runs a PHP script and redirect the output (and errors) to a filename containing the current date. DATE=$(date +"%Y%m%d") ...
3
votes
1answer
691 views

Unable to get the right exit code from a script

I have a script which connects to a remote server via SFTP and get some file from there. My script goes like this: /usr/bin/sftp USER@remote.server.com <<EOF lcd /dir1/dir2/dir3 cd ...
3
votes
2answers
1k views

sftp from Unix server to Window

I am trying to sftp from a Unix box to my computer. I'm use the command: sftp userid@ipaddr where "ipaddr" is the IP Address of my computer. But I'm unable to connect. I tried with ftp and sftpg3, ...
3
votes
2answers
5k views

How to move files in sftp server?

How can I move a file in sftp server on a different directory? I connect to this server using sftp and then try to move a file using mv myfile.csv /my/dir/myfile.csv but this generates an error. ...
3
votes
3answers
3k views

Using nohup on Solaris 10

I need to transfer a large number of files over SFTP (only between Solaris servers) which takes a very long time. I cannot keep my PC on for this duration. I tried: nohup sftp server1 While the ...
3
votes
4answers
3k views

How to use SFTP on a system that requires sudo for root access & ssh key based authentication?

I want to be able to use SFTP to edit files that require root permissions. I'm using SSH Key based authentication - rsa key on smart card. If the system requires sudo to perform root level commands, ...
3
votes
2answers
9k views

Restrict FTP user to a directory

Sorry if this is an obvious question, but I don't have a lot of knowledge about this sort of thing, and I've googled for hours, nothing worked. So on a Ubuntu 11.04 server, I want to restrict a user ...
3
votes
4answers
61 views

How to remove multiple files using sftp

This post is about removing muliple files from the remote server, when sftp password less connection is setup. I have the code as below. Only first file in the variable $file_list gets deleted, when I ...
3
votes
3answers
269 views

Chrooted SFTP user write permissions

I have a setup with sftp only users: Match Group sftponly ChrootDirectory %h ForceCommand internal-sftp AllowTcpForwarding no I get the following message in my secure.log: fatal: bad ...
3
votes
1answer
1k views

sFTP server fails to start

I'm having problems getting sFTP working while there are no problems with ssh. I'm basically building zlib, openssl, and openssh for an ARM processor using an existing embedded Linux filesystem. After ...
3
votes
2answers
2k views

recursive delete with sftp?

I have a host that I can only access with sftp, scp, and rsync-- no ssh. I have a large tree of directories that I want to delete, but my sftp client apparently does not support recursive rms or ...
3
votes
1answer
611 views

Public-Key Authentication w/ Jailed SFTP User

I'm trying to set up a jailed SFTP user account on my own local machine to test an application with libcurl. I used this guide to help me figure out how to set up a jailed SFTP user: ...
3
votes
1answer
2k views

User logged in by sftp does not show up in `w`

My server is Centos 5. I have a chroot environment set up with the following in my sshd_config Match group sftponly ForceCommand internal-sftp ChrootDirectory %h AllowTcpForwarding no ...
3
votes
1answer
6k views

Chrooted SFTP with full access to SSH stopped working (Debian)

I've got a home server on Debian 6 for backups. I'd like to setup chrooted SFTP environment with SSH access for some users (only for my knowledge, there are two users now). It almost works or rather ...
3
votes
1answer
3k views

can not sftp: returns 128 “is the sftp server running”

I can ssh to my EC2 instance (amazon linux) (same user, from same machine, same certificate) however I can no longer use sftp. Logging in via WinScp (via my windows7 box) for SFTP used to work, but ...
3
votes
1answer
681 views

Set visible directories for SFTP access?

I am setting up SFTP access to one of my machines running Linux with the Dropbear SSH server. When I SFTP onto the machine remotely, I can see the entire filesystem on it, even if I might not have ...
3
votes
1answer
9k views

sftp a file using shell script

I have read through several threads (which have been helpful) and I'm still getting an error when trying to sftp a file (client wants it to be sftp'ed) Here is the script: #!/bin/bash ...
3
votes
2answers
2k views

Chroot SFTP users who require access to multiple directories under same parent folder

I have a RHEL 6 server with a /Documents directory, and it has child directories 1 2 3 4 5.... right under the /Documents directory. Is it possible to create an SFTP chroot jail that only gives a ...
3
votes
1answer
2k views

Why does sftp hide the log from stdout?

I have a script a.sh, which has an sftp command: echo "Starting to sftp..." sftp xxx@xxx.xxx.xxx.xx << END_SCRIPT ls mput *.csv.gz bye END_SCRIPT echo "Sftp successfully." If I run it ...
3
votes
0answers
378 views

sshfs breaks symlinks from SFTP server

Does anyone know how to mount a remote SFTP path via SSHFS so that you can work with symlinks? When I do this, all the symlinks I create point to the wrong files (not the ones I linked to.) All the ...
3
votes
2answers
155 views

Denying “/opt/” access for SFTP Users other than particular dir

This is my first (newbie) post here in unix stackexchange. I want to use my WebServer (Debian) as SFTPServer giving access to particular employees. The dir structure is as follows under root: ...
2
votes
2answers
1k views

SFTP with Mysql user pass instead of PAM

Is there a way for people to log onto a debian server via sftp using just mysql database table as authentaction. IE not adding a user to the system? I know it can be done over ftp and TLS but i ...
2
votes
2answers
1k views

Can't copy/move between filesystems with SFTP

Are there any limitations on SFTP that prevents a user from copying between filesystems? I have a SLES with SFTP, and users can't copy/move files between filesystems, even when the target is chmod ...
2
votes
2answers
846 views

Puzzle: transfering files between two servers (ssh, ftp, http multipart…)

A puzzle: files being uploaded in realtime by SCP to SERVER1 need to be transfered to SERVER2. But: SERVER1 doesn't actually have network access to SERVER2 (NAT), however SERVER2 has SSH access to ...
2
votes
1answer
135 views

SFTP chroot jail/access based on wildcard

I want to give a list of people SFTP access to /webdocs/ABC* where they will read-write access to only directories that match this wildcard. How do I do this? Can I create a chroot jaill or some ...
2
votes
1answer
4k views

sftp gives an error: “Received message too long” and what is the reason?

I was able to do sftp yesterday to a RHEL 5.4 box (RedHat) and today I can't. The message is "Received message too long 778199411", and after some investigation, it was due to my RHEL box's .bashrc ...
2
votes
1answer
1k views

Script to get file from SFTP and run it

We have 5 servers running our code: A, B , C, D and E. From a local machine, we sftp the file to A. Then ssh id@A su - applicationname sftp id@A get <file> bye tar -xzf <file> logout ...
2
votes
1answer
852 views

SFTP: give user access to folder outside home

I have a machine running Ubuntu 12.04 LTS with OpenSSH server installed. I have created a user with a jailed home account. When I log in with the user's account, I can only access his home (duh). ...
2
votes
2answers
2k views

How do I transfer multiple files with a common suffix and prefix using an offset?

I have thousands of files whose names are of the form: sequence_1_0001.hmf sequence_1_0002.hmf sequence_1_0003.hmf ... sequence_1_0001.jpg sequence_1_0002.jpg sequence_1_0003.jpg ... ...
2
votes
2answers
6k views

How to connect through sftp to a non-standard port on Midnight Commander?

In Midnight Commander one can make an SFTP connection to a remote machine using: cd #sh:yourusername@example.com:/home/username/ How can this be done when the remote machine is using a non-standard ...
2
votes
4answers
379 views

SSH Do not connect even with publickeys installed

I'm trying to connect two servers. I got the id_dsa.pub key from user john from server A and paste into authorized_keys of user mike from server B. Then I tried to connect from server A to server B ...