By finger tim
on the server, I learned that my default shell is some script /usr/local/bin/bash-wrapper
whose content is:
#!/bin/bash
USERNAME=`whoami`
if ! grep ^$USERNAME$ /etc/domain-users > /dev/null; then
echo -e "You are not authorized to log into this server\n\n"
elif test -z "$2"; then
echo -e "User authorized"
/bin/bash
else #in case users are trying to send a command via ssh or use scp
$2
fi
I now understand the script is the cause of me previously being kicked out upon logging in using ssh. The problem is now gone, because I was just recently added to that file /etc/domain-users
which grep
is searching in.
Now my questions are:
What does the script do if I send a command for the server shell to run in the same line as
ssh
, such as the following two questions Part 2 and Part 3?Is it the cause of the failure of my copy of public key:
$ cat /home/tim/.ssh/id_rsa.pub | ssh tim@server 'cat >> .ssh/authorized_keys' Password: cat: >>: No such file or directory cat: .ssh/authorized_keys: No such file or directory
I also tried
ssh-copy-id
, but it doesn't work either:$ ssh-copy-id tim@server Password: /usr/local/bin/bash-wrapper: line 11: umask: 077;: octal number out of range
The following ssh-tunneling command doesn't run well from my local either:
ssh -f -D 9999 tim@server "if [ -f ~/.tunnel ]; then rm ~/.tunnel; fi; while [ ! -f ~/.tunnel ]; do echo > /dev/null; done"
Here is the error that I get
/usr/local/bin/bash-wrapper: line 11: if: command not found
I wonder why?
My login is always very slow. Is it because the
grep
takes time? Note that the file/etc/domain-users
in whichgrep
searches has 199 lines and each line is a username. Is it supposed to take long forgrep
to do its job?- How can I change my default shell?
Thanks and regards!
pam_access
module. Its designed for EXACTLY this purpose. – phemmer Jan 19 '12 at 00:03pam_access
module (http://linux.die.net/man/8/pam_access). – phemmer Jan 19 '12 at 03:40