What is a remote server?
A remote server is a repository for your applications and files that is not connected to your local network.
Remote servers can be:
- Database servers
- Web servers
- DNS (Domain Name Service) servers
- Mail servers
- Proxy servers
- Application servers, and
- Real-time Communication Servers (skype, VoIP)
How do you connect to and communicate with a Remote Server?
There are multiple ways:
- FTP: File Transport Protocol, using a file transfer program such as FileZilla or WinSCP. You just need to setup the hostname (your server address) and enter your authentication details (username and password) and you will be able to transfer files from your local pc to the remote server.
- Telnet: Is a protocol that allows for bidirectional (to and from server) text communication. Similar to command line and terminal to communicate with the remote host. Unfortunately Telnet does not encrypt data sent to and from the server. There is also no default authentication so this protocol has been rarely used based on it's security flaws.
- Secure Shell (SSH): Is a cryptographic network protocol that secures data communication, remote shell services and command line execution between computer. Common applications for windows is Putty but it is built in with Unix like operating systems as (Terminal).
Common Server Commands
cd foldername //move into that directory cd /foldername //move into that directory which is one up from where we are cd .. //move to the directory one up from where we are
ls //show directories and files ls -la //show directories and files with additional information
Editing A File
vim filename.txt //edit a file with the in-built vim editor
There is however a limitation of vim:
Because it is run through command line, functionality such as: find and replace, use of cursor, copy, paste and other common features in text editors are missing.
So How can we Edit Text Live on the Server?
Well the Solution is:
Rmate or Rsub
1. Install SublimeText or Textmate on your pc
(Sublimetext is for all OS's, Textmate only Mac)
2. SSH into your server
3. Install Ruby Gems on the Server
4. install rmate
gem install rmate
5. update rmate
gem update rmate
6. tell sublimetext or textmate to listen on port 52698
7. use the following command to open the file in sublimetext or textmate from the server
ssh -R 52698:127.0.0.1:52698 email@example.com rmate filename.txt
8. you can now edit the file as you would a in a normal textfile, when you hit save it will save on the server.