Go away, boring passwords

This article was originally posted on TrendSpace

Are you boring with inputting passwords so many times or remember so many different passwords? Here is the way we can save much time in typing passwords in Linux.

1) For FTP passwords

Create a file with the name ~/.netrc with lines in the following format:

machine <Site Name> login <User Name> password <Password>

This information will be used by ftp/lftp/wget to login the corresponding site. After providing the login information in this file, you no longer need to type in the user name or password when accessing the corresponding sites.

Be careful, in order to enhance security, the ~/.netrc file should have the 600 access right.

For more information, see “man 5 netrc”.

2) For SSH connection

If you need to login or copy files with another machine via SSH connections frequently, you can set up public and private key pair using the DSA encryption scheme to save the work of typing passwords.

On local machine:

$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t dsa
$ chmod 600 id_dsa{,.pub}

Here, you got your private key in id_dsa file and your public key in id_dsa.pub file. Do keep your id_dsa file secret and send the id_dsa.pub file to the remote machines you want to access.

Copy id_dsa.pub file to remote machines and add it’s content to ~/.ssh/authorized_keys file on the remote machine, after doing this, you can access the remote machine via SSH (ssh,scp,sftp) without input passwords.

For more information, see “man ssh”.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据