Tuesday, October 30, 2012

SSH: Agent Admitted Failure To Sign...

When you encounter error message of "SSH: Agent Admitted Failure To Sign..." with your new ssh key, just simply log off current session and re-login again.

Another way to fix this issue within the current session is to type # ssh-add, then the new key will be added to ssh-agent.

REFERENCE:
http://www.cyberciti.biz/faq/unix-appleosx-linux-bsd-agent-admitted-failuretosignusingkey/

ssh port-forwarding in the background

$ ssh -fNL 2222:localhost:2222 pride

REFERENCE :
Lucas, M. W. SSH Mastery: OpenSSH, Tunnels and Keys

Monday, October 29, 2012

chmod -R 700 ~/.ssh for authorized_keys

permission of 700 may be required for correct setup of ssh key authorization!

Sunday, October 28, 2012

chroot sftp & batch it!

1) edit /etc/ssh/sshd_config:
Match User backup
ChrootDirectory /var/backup
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

2) # kill -HUP `cat /var/run/sshd.pid`

3) create the new user, generate key,  and set permissions:
# mkdir -p /home/backup/.ssh
# useradd backup
# ssh-keygen -t dsa 
# cp id_dsa.pub /home/backup/.ssh/authorized_keys
# mkdir -p /var/backup/dir1
# chown root:wheel /var/backup
# chmod 755 /var/backup
# chown backup /var/backup/dir1

3) edit a batch file, sftp_batch  for sftp:
cd dir1
put myfile

4) then, fireup sftp client for batch processing now!
# sftp -b sftp_batch backup@localhost

REFERENCES:
http://www.howtoforge.com/chrooted-ssh-sftp-tutorial-debian-lenny