[cygwin:~/] ssh-keygen -t rsa (leave passphrase empty to make ssh-login easier)
[cygwin:~/] cd .ssh
[cygwin:~/] scp id_rsa.pub username@remote_host:.ssh/ (enter password this time)
[cygwin:~/] ssh username@remote_host (enter password this time)
[remote_host:~/] cd .ssh (create one if not existed)
[remote_host:~/] touch authorized_keys (create this file is not existed)
[remote_host:~/] cat id_rsa.pub >> authorized_keys
[remote_host:~/] rm -f id_rsa.pub
[remote_host:~/] chmod 600 authorized_keys
[remote_host:~/] cd ..
[remote_host:~/] chmod 700 .ssh
[remote_host:~/] exit
[cygwin:~/] ssh username@remote_host
[========== no password anymore, also for scp ===========]
Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts
Monday, February 4, 2008
Auto ssh login from Cygwin to linux server
I have a ssh2 client software installed before the installation of cygwin, but I never tried the auto login by public key successfully, one reason, I guess, is that my remote server doesn't have SSH2 server installed. Now that I am using cygwin, i install the openssh (not openssl) module from cygwin installation packages.
Thursday, January 31, 2008
Install Cygwin, Linux Commands and GVim with Windows Vista
- Download the "setup.exe" program from Cygwin (http://www.cygwin.com/setup.exe) then install it.
- At the time of installing cygwin, select modules to install as you wish, such as cron, zip, unzip, shutdown, wget, openssh, perl.
- Download the self-installing-on-windows executable GVim program from vim online (ftp://ftp.vim.org/pub/vim/pc/gvim71.exe) then install it.
- Put vim installation path into the windows environment variable "PATH".
- To set the colorscheme of GVim, create a .gvimrc file into home directory, say c:\Users\your_user_name\ with a line "colorscheme your_scheme", my favorite is murphy.
- Open cygwin program, click "Properties" on the left top menu to set cygwin with your favorite color scheme and font.
- To improve bash of cygwin, put a .bashrc file into home directory, but there are two tricks. Firstly cygwin may somehow ignore the .bashrc (I don't know why), the solution to this problem is to put an executable string in the bottom of /etc/profile:
. "$HOME/.bashrc"
- Secondly if the format of .bashrc is pc not unix, this file may not be executed correctly. I use EditPlus to transfer the format to unix.
- My .bashrc file is like this:
##################################################
# .bashrc file
##################################################
# PATH
#=================================================
# Add "." and "~/bin" to PATH varible:
# export PATH=.:/home/user_name/bin:`printenv PATH`
# Aliases
#=================================================
alias more=less
alias up='cd ..'
alias ll='ls -la'
alias ls='ls -F'
alias ps='ps -Wl'
alias home='cd $HOME'
alias which='type -path'
alias unix2dos='recode lat1:ibmpc'
alias dos2unix='recode ibmpc:lat1'
alias h='history 30'
alias rmf='rm -Rf'
alias v='vim'
alias su='su -'
alias tails='tail -f -n 100'
# Shell Prompt customization (cygwin or unix version)
#=================================================
export PS1="\n[xb@dell:\w]\$ "
##################################################
# END .bashrc
##################################################
- Use SSH ssh-keygen2 to generate public and private keys, scp public key to remote server's .ssh directory, cat public key to authorized_keys. Open file hosts at C:\Windows\System32\drivers\etc to add the ip address and a brief hostname for your remote server. Use ssh username@remote_hostname to login in the future.
Subscribe to:
Posts (Atom)