All Projects → clarkwang → Passh

clarkwang / Passh

Licence: gpl-3.0
sshpass is broken by design

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Passh

Wordmove
Multi-stage command line deploy/mirroring and task runner for Wordpress
Stars: ✭ 1,791 (+2655.38%)
Mutual labels:  automation, ssh
Paramiko Tutorial
📡🐍SSH & SCP in Python with Paramiko
Stars: ✭ 65 (+0%)
Mutual labels:  automation, ssh
Webterminal
ssh rdp vnc telnet sftp bastion/jump web putty xshell terminal jumpserver audit realtime monitor rz/sz 堡垒机 云桌面 linux devops sftp websocket file management rz/sz otp 自动化运维 审计 录像 文件管理 sftp上传 实时监控 录像回放 网页版rz/sz上传下载/动态口令 django
Stars: ✭ 1,124 (+1629.23%)
Mutual labels:  automation, ssh
Vssh
Go Library to Execute Commands Over SSH at Scale
Stars: ✭ 707 (+987.69%)
Mutual labels:  automation, ssh
Exscript
A Python module making Telnet and SSH easy
Stars: ✭ 337 (+418.46%)
Mutual labels:  automation, ssh
Assh
💻 make your ssh client smarter
Stars: ✭ 2,340 (+3500%)
Mutual labels:  automation, ssh
Sshkit.ex
An Elixir toolkit for performing tasks on one or more servers, built on top of Erlang’s SSH application.
Stars: ✭ 108 (+66.15%)
Mutual labels:  automation, ssh
Deployr
A simple golang application to automate the deployment of software releases.
Stars: ✭ 282 (+333.85%)
Mutual labels:  automation, ssh
Goexpect
Expect for Go
Stars: ✭ 538 (+727.69%)
Mutual labels:  automation, ssh
Sshkey Audit
Automate SSH key management
Stars: ✭ 55 (-15.38%)
Mutual labels:  automation, ssh
Apple Automation
iOS/macOS 自动化,效率玩法探索。
Stars: ✭ 60 (-7.69%)
Mutual labels:  automation
Kube Gen
Generate files from Kubernetes events
Stars: ✭ 59 (-9.23%)
Mutual labels:  automation
Resume Builder
Resume Builder is a free open-source project that allows anyone to easily maintain and build any kind of resume.
Stars: ✭ 62 (-4.62%)
Mutual labels:  automation
Botsharp
The Open Source AI Chatbot Platform Builder in 100% C# Running in .NET Core with Machine Learning algorithm.
Stars: ✭ 1,103 (+1596.92%)
Mutual labels:  automation
Forked Daapd Card
forked daapd card for Home Assistant Lovelace UI
Stars: ✭ 60 (-7.69%)
Mutual labels:  automation
Tis 3d
TIS-100 inspired low-tech computing in Minecraft.
Stars: ✭ 64 (-1.54%)
Mutual labels:  automation
Webwhatsappbot
Core to automatize whatsapp - working 11/2018
Stars: ✭ 59 (-9.23%)
Mutual labels:  automation
Opencomputers
Home of the OpenComputers mod for Minecraft.
Stars: ✭ 1,104 (+1598.46%)
Mutual labels:  automation
Centos7 Cis
Ansible CentOS 7 - CIS Benchmark Hardening Script
Stars: ✭ 64 (-1.54%)
Mutual labels:  automation
Androidviewclient
Android ViewServer client
Stars: ✭ 1,112 (+1610.77%)
Mutual labels:  automation

passh

NOTE: The pty related code is stolen from the APUE book.

compile

$ cc -o passh passh.c

usage

Usage: passh [OPTION]... COMMAND...

  -c <N>          Send at most <N> passwords (0 means infinite. Default: 0)
  -C              Exit if prompted for the <N+1>th password
  -h              Help
  -i              Case insensitive for password prompt matching
  -n              Nohup the child (e.g. used for `ssh -f')
  -p <password>   The password (Default: `password')
  -p env:<var>    Read password from env var
  -p file:<file>  Read password from file
  -P <prompt>     Regexp (BRE) for the password prompt
                  (Default: `[Pp]assword: \{0,1\}$')
  -l <file>       Save data written to the pty
  -L <file>       Save data read from the pty
  -t <timeout>    Timeout waiting for next password prompt
                  (0 means no timeout. Default: 0)
  -T              Exit if timed out waiting for password prompt
  -y              Auto answer `(yes/no)?' questions

Report bugs to Clark Wang <[email protected]>

supported platforms

Tested on:

  • OpenWRT 15.05.1, ramips/mt7620 (on Newifi Mini, or Lenovo Y1 v1)
  • Debian Linux 8, x86_64 (Jessie)
  • macOS 10.12 (Sierra)
  • Cygwin, x86_64 (on Windows 7)
  • FreeBSD 11.1, x86_64
  • AIX 7.2, ppc64le (added in issue #7)

why i wrote passh

  1. I got a Newifi Mini router and installed OpenWRT on it. I want the router to be my SOCKS proxy so I run ssh -D 8888 [email protected] automatically at boot time but the SSH server only supports password auth. On Linux I would use Expect to automate ssh but OpenWRT does not install Expect by default and my router does not have enough storage for the extra Tcl and Expect packages.

  2. Then I tried sshpass but sshpass seems more like a nice hack and it's broken by design. See following example on a Linux system:

     $ tty
     /dev/pts/18                                      // now we're on pts/18
     $ sshpass bash --norc
     bash: cannot set terminal process group (-1): Inappropriate ioctl for device
     bash: no job control in this shell
     bash-4.4# tty
     /dev/pts/18                                      // the bash's stdin is also connected to pts/18
     bash-4.4# ps p $$
        PID TTY      STAT   TIME COMMAND
      37151 pts/36   Ss+    0:00 bash --norc          // but the controlling terminal is pts/36
     bash-4.4# ps t pts/36
        PID TTY      STAT   TIME COMMAND
      37151 pts/36   Ss+    0:00 bash --norc
      37154 pts/36   R+     0:00 ps t pts/36
     bash-4.4#
    

    Now let's try passh:

     $ tty
     /dev/pts/18                                      // now we're on pts/18
     $ passh bash --norc
     bash-4.4# tty
     /dev/pts/36                                      // the bash's stdin is connected to the new pts/36
     bash-4.4# ps p $$
        PID TTY      STAT   TIME COMMAND
      37159 pts/36   Ss     0:00 bash --norc          // pts/36 is its controlling terminal
     bash-4.4# ps t pts/36
        PID TTY      STAT   TIME COMMAND
      37159 pts/36   Ss     0:00 bash --norc
      37162 pts/36   R+     0:00 ps t pts/36
     bash-4.4#
    

    See sshpass-broken.md for more sshpass is broken examples.

examples

  1. sshpass is better in its own way.

    For example, you can use rsync + sshpass like this:

     $ rsync -e 'sshpass -p password ssh' file [email protected]:/dir
    

    But with passh you have to:

     $ passh -p password rsync -e ssh file [email protected]:/dir
    

    Another example, with sshpass you can:

     $ echo date | sshpass -p password ssh [email protected] bash
    

    But with passh you have to:

     $ passh -p password bash -c 'echo date | ssh [email protected] bash'
    
  2. Start SSH SOCKS proxy in background

     $ passh -n -p password ssh -D 7070 -N -n -f [email protected]
    

    Here -n is required or ssh -f would not work. (I believe the bug is in OpenSSH though.)

  3. Login to a remote server

     $ passh -p password ssh [email protected]
    
  4. Run a command on remote server

     $ passh -p password ssh [email protected] date
    
  5. Share a remote server with others and want to use your local bashrc?

     $ passh -p password scp /local/bashrc [email protected]:/tmp/tmp.cAE8Kv
     $ passh -p password ssh -t [email protected] bash --rc /tmp/tmp.cAE8Kv
    
  6. Or just for fun

     $ passh bash
     $ passh vim
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].