Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Operate Remote Servers Using SSH

General Tips and Traps

  1. The permissions of the directory ~/.ssh and its subcontents on both the local machine and the remote server must be properly set in order for SSH login via public key to work. A good pratice is to set the permission of ~/.ssh to 700 (on both …

Terminal Multiplexers

zellij

  1. There are 2 mature popular terminal multiplexer apps: screen and tmux. Both of them are very useful if you want to work on multiple tasks over 1 SSH connection. Screen is relative simple to use while tmux is much more powerful and more complicated to use.

  2. Besides enabling users to …

Transfer Files over Network in Linux

Comparison of Network Drives (Remote File System)

  1. NFS is very fast but not secure and it is for Unix/Linux only. It is a good choice for local network sharing.

  2. Samba is fast, secure and cross-platform. it is good for general purpose sharing and popular in companies.

  3. SSHFS is slow …

Configure SSH to Use a Proxy Server

Suppose you have a production server that you want to visit via SSH, however, it is not accessible directly. Instead, you have to visit it from a bastion/proxy server. You can configure SSH to use the bastion/proxy server when visiting the production server.

Host <production_server>
ProxyCommand ssh <proxy_server …

Copy SSH Public Key Using "ssh-copy-id"

You can use the following command to copy your SSH public key to a Linux server.

ssh-copy-id -i ~/.ssh/id_rsa.pub host_machine

However, if a Linux server runs the SSH deamon on a non default port (default is 22), you have to specify the port with option -p port. In …