Ben Munat schrieb: > Yikes... guess I gotta be careful with what I add to my .bashrc... added > this to root's .bashrc and locked myself out of my system! > > Before I exited (and then couldn't reconnect) I looked at ps -e and > there were hundreds of screen/bash processes... something went haywire. > > Managed to rm the .bashrc with ssh ... rm .bashrc but still had to > reboot to login... even restarting sshd (via webmin) didn't do the trick. > > So a warning to anyone who sees the previous message and tries it... do > it on a local machine first (I went straight for root on my remote > server... :-O) >
Yes, you are absolutely right. Sorry, but instead I suggest using:
[ $SHLVL -eq 1 ] && screen -A -m -d -S <screen name> /bin/bash
But in general I wouldn't use root's bashrc to test such scripts. And I
recommend keeping a separate ssh session running, so you remain able to
remove faulty .bashrc's. Another thing which you should consider, at
least for testing, is using ulimit. ("man ulimit") It gives you the
possibility to limit the amount of processes a user can start.
Just one word of explanation to the corrected line. At least in my
system any bash instance invoked by screen gets a SHLVL greater than 1.
Checking this env variable before running screen ensures that only your
first root shell will start screen.
To be honest I just forgot that *any* bash which is started, will
evaluate .bashrc.
begin:vcard fn:Christian Spoo n:Spoo;Christian adr;quoted-printable:;;Am Kaiser 26;W=C3=BCrselen;NRW;52146;Deutschland email;internet:[EMAIL PROTECTED] tel;fax:02405/475071 tel;home:02405/493466 tel;cell:0176/61055475 x-mozilla-html:FALSE version:2.1 end:vcard
signature.asc
Description: OpenPGP digital signature
