Quantcast
Channel: Redino blog
Viewing all articles
Browse latest Browse all 80

SFTP ls command returns no files

$
0
0

I created a new user called phone for the client, and created a new directory /home/phone as his home directory. Next create some files for testing purpose.

cd /home/phone
touch a b c

Then modify /etc/ssh/sshd_config to set chroot configuration

Match User phone
    ForceCommand internal-sftp
    ChrootDirectory /home/phone

But logging in with this new user and run ls command, no files are listed, it returns nothing.. But if I run ls in ssh, the files are shown.

root@iZbp14uomoa9zt7kqaxumcZ:/home/phone# ls
a  b  c

After trying lots of time, the reason is found: It’s because there is no “x” permission for /home/phone directory..

root@iZbp14uomoa9zt7kqaxumcZ:~# ls -lh /home
drw-r--r-- 3 root root 4.0K Sep  3 11:34 phone

What is “x” permission?

The “x” permission for directory is used to traverse directory. And the “x” permission for file is for file execution.

Then run following command to add “x” permission for /home/phone

chmod 744 /home/phone

And try running ls command in sftp again, the issue is fixed now, we can see files are listed now.

The post SFTP ls command returns no files appeared first on Redino blog.


Viewing all articles
Browse latest Browse all 80

Trending Articles