6 SSH
oooo-ps edited this page 2025-06-28 06:30:13 +03:00

The tips below provide configuration details for accessing remote files over SSH.

Server

Linux

System user

  1. useradd -m nexy - create new system user with its home directory
  2. passwd nexy - provide strong password
  3. su nexy - login as nexy
  4. cd - navigate to the home folder
  5. mkdir /home/nexy/public - create location for the public fies

Firewall

Warning

Be careful when changing existing access rules, as you may lose access to your remote server!

  • if that happens, try logging in with localhost or the web console to roll back

Tip

By logging in with password, take a look at fail2ban to prevent brute force attacks

Don't forget to open the SSH port to access your server remotely:

sudo ufw allow 22
  • replace 22 with your custom port (if it's not default)
  • use additional filters to allow access from specified hosts.

Client

VSCode

This example is useful for syncing text files on save. Make sure you have this SSH extension installed to continue.

Create .vscode/sftp.json file in the local project directory:

{
    "name": "",
    "host": "",
    "protocol": "sftp",
    "port": 22,
    "username": "nexy",
    "password": "",
    "remotePath": "/home/nexy/public",
    "uploadOnSave": true,
    "useTempFile": false,
    "ignore": [
        ".vscode"
    ]
}
  • provide your actual SSH name,host,username,password and remotePath
  • save and restart VSCode to apply the changes