1

I have created one Linux CentOS 6 instance in Amazon EC2 and installed cPanel on it and started running my websites there. The issue I face was when I try to FTP to the instance with the following config

IP : Instance IP 
Username : centos 
Password : Blank  
Mode : SFTP 
SFTP Key : Private KEY (PEM) Provided by Amazon EC2 dashboard

I got to view only

/home/centos

directory

But I want to view the main directory which is back to home directory

When I tried to click

..

in FileZilla it says

"Permission Denied"

So I tried the following

vipw /etc/passwd

and changed

centos:x:1000:1000:Cloud User:/home/centos:/bin/bash

to

centos:x:1000:1000:Cloud User:/ :/bin/bash

and even to

centos:x:1000:1000:Cloud User: :/bin/bash

However , after this change FTP stopped logging in

Finally, I reverted back to

centos:x:1000:1000:Cloud User:/home/centos:/bin/bash

Kindly guide me to achieve this.

1 Answer 1

-1

You may use VSFTP instead of SFTP, in VSFTP you can customize your root dir without any change in the /etc/passwd. If you modified in the passwd file, it will also affect when login. If you got permission denied when change your home dir to /, you need to check the permission of / first. Make sure others have read permission like below:

# ls -ld /
dr-xr-xr-x. 25 root root 4096 May 20 15:47 /

For VSFTP configuration details please take this as refference: https://security.appspot.com/vsftpd/vsftpd_conf.html

Change local_root to your desired directory and disable chroot_local_user may meet your request.

1
  • If I remember correctly vsftp does not support ssh encryption (only TLS and not by default). If that is true vsftp should not be used as an alternative!
    – Ned64
    Commented Dec 2, 2021 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .