Monday, 23 February 2015

Execute commands on a remote Linux machine

We know that ssh is used to remote login to a server. But did you know that we can use ssh to execute command or script on a remote system. This is the syntax how we can do it:

ssh [USER]@[IP] [command or script]


Let us look at how this can be done. Suppose you want to display the directory contents of /root of a remote host, you can run the following command:

ssh root@192.168.1.79 ls -l

N.B. - It will ask for the password.

In the same way you can execute any script on the remote machine.


Monday, 2 February 2015

Securing files

    Here is a simple tip to password protect your files:

               vi -x test.txt

    This command will ask for an encryption key. You have to type the key twice. Then save and quit the opened file.
     Now, whenever you open this file, it will ask for that password first. Remember, this will only encrypt the content of the file. Anybody, can enter a wrong password and update the file.