Posts

Showing posts with the label sshd_config

Another SSH tunneling trick - to get you ssh into your blocked server from the outside world

I wrote a blog post about SSH tunneling 4 years ago at this . Today I will show you another trick that gets you into the server behind firewalls. Normally, corporate's firewalls will block all the incoming ports except port 80 and 443 which are using for accessing the web servers. So, here are how to can get access to the servers from outside (assuming you have access to the server you want to connect to from inside the corporate network): 1. If the server you want to connect to doesn't have anything web or anything running on port 80/443, you just need to change its's ssh config to let sshd runs on port 80/443. sudo nano /etc/ssh/sshd_config ... Port 80 ... sudo systemctl restart ssh 2. If your server already has a web or a server that runs on port 80/443, use another server that you can access from inside the network and free of port 80/443.  Then establish the tunnel, assuming: server.A.com: the server that I have access from inside the network server....

Create a SFTP access only user to transfer files from and to a WordPress installation

So I heard that you want to enable FTP access (read + write) to a specific folder inside your WordPress (or any folder) directory to a specific user without installing the FTP service . SFTP is one way to achieve that. Follow these steps: Assuming: myuser: the user you want to grant access. /var/www/myvhost: is a WordPress installation directory. /var/www/myvhost/the_shared_folder (or the wp-content folder) : is a folder inside your WordPress root you want to grant access to myuser. 1. Create the user and specify the shared folder as her home directory: $ sudo useradd -d /var/www/myvhost/the_shared_folder myuser $ sudo passwd myuser 2. Disable shell login on myuser : $ sudo usermod -s /bin/false myuser 3. Configure ssh: $ sudo nano /etc/ssh/sshd_config ... #Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp internal-sftp ... Match User myuser         X11Forwarding no         ChrootDirectory /var/www/my...