Advertisement
Guest User

Untitled

a guest
May 1st, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. addgroup echoonly
  2. CHROOT=/var/chroot/echo
  3. mkdir -p "$CHROOT"
  4. chown root:root /var/chroot "$CHROOT"
  5. # dependig on distro it might be /usr/bin/cat -> check with `which echo`
  6. useradd -d "$CHROOT" -s /bin/cat -M -N -g echoonly echo
  7. passwd -d echo # make account passwordless
  8. # Let's make chroot
  9. mkdir -p "$CHROOT"/var/chroot/echo
  10. mkdir -p "$CHROOT"/bin
  11. cp /bin/cat "$CHROOT"/bin/echo
  12. mkdir "$CHROOT"/dev/pts
  13. echo '/dev/pts "$CHROOT"/dev/pts none defaults,bind 0 0' >> /etc/fstab
  14. mount "$CHROOT"/dev/pts
  15.  
  16. $ $EDITOR /etc/ssh/sshd_config # add:
  17. # based on https://goo.gl/TjhrWd
  18. Match user echo
  19.       ChrootDirectory /var/chroot/cat
  20.       X11Forwarding no
  21.       AllowTcpForwarding no
  22.       ForceCommand /bin/echo
  23.       PasswordAuthentication yes
  24.       PermitEmptyPasswords yes
  25.  
  26. ssh echo@1.2.3.4
  27. echo@1.2.3.4's password:
  28. Permission denied, please try again.
  29.  
  30. /usr/sbin/sshd -ddd -p 1234
  31. (...)
  32. debug1: userauth-request for user echo service ssh-connection method password [preauth]
  33. debug1: attempt 2 failures 1 [preauth]
  34. debug2: input_userauth_request: try method password [preauth]
  35. debug3: mm_auth_password entering [preauth]
  36. debug3: mm_request_send entering: type 12 [preauth]
  37. debug3: mm_auth_password: waiting for MONITOR_ANS_AUTHPASSWORD [preauth]
  38. debug3: mm_request_receive_expect entering: type 13 [preauth]
  39. debug3: mm_request_receive entering [preauth]
  40. debug3: mm_request_receive entering
  41. debug3: monitor_read: checking request 12
  42. debug3: PAM: sshpam_passwd_conv called with 1 messages
  43. debug1: PAM: password authentication failed for echo: Authentication failure
  44. debug3: mm_answer_authpassword: sending result 0
  45. debug3: mm_request_send entering: type 13
  46. Failed password for echo from 192.168.1.1 port 43816 ssh2
  47. debug3: mm_auth_password: user not authenticated [preauth]
  48. debug3: userauth_finish: failure partial=0 next methods="publickey,password" [preauth]
  49.  
  50. sudo sed -i 's/nullok_secure/nullok/' /etc/pam.d/common-auth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement