Create FTP access for Lightsail LAMP Stack

0

What is the best practice of creating an FTP account for another use, Rather than giving SFTP access on the default key? Say, a developer needs to login and TEST or Implement a sample code, I need to give them a FTP or Cpanel like access so he can access and check,

Jayanga
asked 5 months ago624 views
1 Answer
0

Hello.

Is your question more about how to manage Linux OS than AWS?
What I often do is create a Linux user for each development member, create an SSH private key, and then set /etc/ssh/sshd_config so that SCP can only be entered in the necessary directories.

profile picture
EXPERT
answered 5 months ago
  • Can you tell me how to achieve above please,,I am new to these commands and AWS lightsail,

  • You can add Linux users by following the steps in the document below. https://repost.aws/knowledge-center/new-user-accounts-linux-instance

    sudo adduser new_user
    sudo su - new_user
    cd
    mkdir .ssh
    chmod 700 .ssh
    touch .ssh/authorized_keys
    chmod 600 .ssh/authorized_keys
    cat >> .ssh/authorized_keys
    

    The following command is a preparation to allow connection only to "/opt/new_user".

    sudo mkdir /opt/new_user
    sudo chown new_user:new_user /opt/new_user/
    sudo chmod 755 /opt/new_user/
    

    The following command creates a backup of "sshd_config" and opens the file.

    sudo cp -pi /etc/ssh/sshd_confg /etc/ssh/sshd_config.bk
    sudo vim /etc/ssh/sshd_config
    

    When you open "sshd_config", add the following settings to the last line.

    Subsystem sftp  internal-sftp
    Match User new_user
        ChrootDirectory /opt/new_user
        X11Forwarding no
        AllowTcpForwarding no
        PasswordAuthentication yes
        ForceCommand internal-sftp
    

    After saving the file, restart the SSH service with the following command.

    sudo systemctl restart sshd.service
    

    By following the steps above, you can create a user who can only connect to "/opt/new_user" via SFTP.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions