Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Saturday, October 24, 2009

Linux: vnc via ssh

remind myself:
1. start 'vncserver -name X' on server computer (that you try to connect by ssh)
Note: X is a session name which is defined in the file: ~/vnc/xstartup
2. ssh -L 5902:localhost:5901 YourAccountName@YourServerID(or hostname) in one local terminal
3. vncviewer localhost:5902 in your another local terminal

Wednesday, November 12, 2008

linux:shell: broken 'while' loop

When I do a while loop in which there is a command 'ssh', the while loop just goes only one iteration and quits. The problem is from 'ssh' read stdin so that 'while' cannot read anymore and stop afterwards, for example,

while read CompName
do
ssh $CompName 'ls'
echo "Done"
done <>

In the example, only one iteration is conducted (including the echo line). The solutions are provided by google searching. One is general one, I think. 1) Redirect ssh stdin by

< /dev/null ssh $CompName 'ls'

2) ssh-specified trick: use '-n':

ssh -n $CompName 'ls'

Saturday, July 26, 2008

linux:ssh:kerberos

Installing proper kereros and connecting with fermilab by ssh are always a bit tricky. Sometimes it needs old version openssh, sometimes it needs more... I don't know. One guy from Fermilab has a post talking about his experience based on ubuntu:

http://ubuntuforums.org/showthread.php?t=486284

I didn't follow his steps (since I just installed a new system, I need to install what I need). The basic idea is:

  • install openssh (I installed newest one)
  • install krb5
  • sudo apt-get install krb5-user
  • copy configure file (/etc/krb5.conf) from any computer of fermilab to your local computer (in the same location)
then you could connect !

Although you could connect, please make sure you have right parameters both in ssh_config and sshd_config due to Fermilab security policy. I have a problem with it (once log in to one computer of clued0, I type klist, nothing found). I got the solution from kerberos-users of fnal:
===
Make sure your SSH client configuration in ssh_config (usually in /etc/ssh/)
contains the lines

GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
===

Monday, August 13, 2007

Network: a problem about 'Connection reset by peer'

When I log in a remote computer by ssh from my home and if I keep it inactive for a while (for example, 10 mins), I often was kicked out with the message, for example:
=====================

Read from remote host jasper-clued0.fnal.gov: Connection reset by peer
====================

This happened probably because a firewall or other packet filtering device (such as your router) drops idle connections after a certain period of time.

------------------------------------------
A solution based on the ssh server side
can be found here (Dugan provided me with this solution):

http://www.brandonhutchinson.com/OpenSSH_ClientAliveInterval.html

Simply speaking, the solution is add a line

ClientAliveInterval 300

in the file:

/etc/ssh/sshd_config

and reload the sshd server configuration with

/sbin/service sshd reload

--------------------------------------
Another solution based on client side provided by my colleage Horst at Fermilab is:
to add

echo 300 > /proc/sys/net/ipv4/tcp_keepalive_time

into the file /etc/rc.local

Monday, May 7, 2007

Linux:ssh: how to use ssh command remotely

Usually, when you want to run a command on a remote computer, you have to log in first. If you have ssh, you can use remote-command way:

ssh your.remote.computer.com yourCommandHere

For example,
ssh smart.phys.sfu.ca date

Thursday, April 12, 2007

Linux: ssh welcome text

Add your SSH welcome information to the file /etc/motd.

Monday, April 2, 2007

Linux: how to password-less ssh

If you log in some severs by ssh frequently, you may not like to input your password every time, why not set up password-less ssh? Okay, let me to classify some words:

  • client: the computer where you are right now.
  • server: the computer into which you like to log
The procedure as follows:

1. Key pair generation on client.

ssh-keygen -t rsa
(don't input any passphrase when you are required to input)

Thus you get two files under ~/.ssh (private key file: id_rsa and the public key: id_rsa.pub)

2.Copy the public key file to server (under the directory: ~/.ssh) and append it to the file authorized_keys. For secruity, do
chmod 600 authorized_keys

3.Okay.

More detailed and accurate descriptions are available here.






Locations of visitors to this page