> Bopolissimus Platypus wrote: > > kill `cat /var/run/sshd.pid`
On Friday 30 January 2004 09:59, Ariz Jacinto wrote: > won't that also kill the session? #ps auxw | grep sshd | grep -v grep root 1026 0.0 0.1 2932 440 ? S Jan29 0:00 /usr/sbin/sshd root 30333 0.1 0.7 6388 1788 ? S 10:26 0:00 [sshd] tiger 30335 0.1 0.9 6444 2036 ? S 10:26 0:00 [sshd] [comment. 1026 is the listener, 30333 and 30335 are running sessions] #cat /var/run/sshd.pid 1026 #kill `cat /var/run/sshd.pid ` #ls -l /var/run/sshd.pid ls: /var/run/sshd.pid: No such file or directory [ ok, we killed the listener using my suggestion, the sshd.pid file no longer exists because there's no listener anymore ] #ps auxw | grep sshd | grep -v grep root 30333 0.0 0.7 6388 1788 ? S 10:26 0:00 [sshd] tiger 30335 0.0 0.9 6444 2036 ? S 10:26 0:00 [sshd] [comment. to verify, there's no 1026 process anymore. to verify some more, i could try to ssh from another box, but i won't do that na lang :] so the old running sessions are still running, but the sshd daemon listener is no longer running. you can still control the computer using the old running session. but you can't create a new ssh session anymore (i.e., from a remote box, you can't ssh into this box anymore since there is no longer an sshd listener to accept connections). > what's the use of the session without > the service? i've run into this before. when changing things on the box (e.g., long ago i was tweaking stuff on /etc/ssh/sshd_config and killing and restarting the sshd daemon would die because the options were wrogn :), you often want to keep a root shell running in case your changes break things. even longer ago (before ssh existed), if i did something dumb like changing roots shell to something that didn't exist (i'd think that i was changing a regular user's shell but i changed root shell pala, or maybe it was something else that would make it impossible to even login as root at the console), i might be locked out of my own box :). it became my habit, when doing things that might break, to always have a root shell open and then do my work and testing in another console or telnet session. that way, if i locked myself out, i still had the root shell and could fix things. > or will there be really a continuity of session (if you're > right about it) when the sshd is restarted? the transcript above (with comments) demonstrates that it works for me. try it on your box though. i suppose it's possible for some security paranoid systems to not work that way. or broken ssh implementations (if the children die when the parent dies). in the original poster's email, when he runs his script, it kills ALL sshd instances. that includes not just the listener (which accepts ssh connections) but also currently running sessions. he might want to keep the currently running sessions and only kill the listener. e.g., if he's managing the box remotely and wants to restart the sshd server after he kills it :). without session continuity, he'd have to either have a cron job restart sshd, or start sshd from inittab so that init will notice and restart the job, or walk over to the console, login and restart sshd. i've had to do all three on different occasions, on different boxes :). since only the listener daemon is killed. the running sessions don't die. and therefore, when sshd is restarted, if the running sessions were still there (user did not exit), then sure, the running sessions will still be running when sshd is restarted. because they never died. tiger -- Gerald Timothy Quimpo gquimpo*hotmail.com tiger*sni*ph http://bopolissimus.sni.ph Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78" This is a court of law, young man, not a court of justice. Oliver Wendell Holmes. -- Philippine Linux Users' Group (PLUG) Mailing List [EMAIL PROTECTED] (#PLUG @ irc.free.net.ph) Official Website: http://plug.linux.org.ph Searchable Archives: http://marc.free.net.ph . To leave, go to http://lists.q-linux.com/mailman/listinfo/plug . Are you a Linux newbie? To join the newbie list, go to http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie
