initial commit
This commit is contained in:
24
custom-cmds-in-ubuntu/bin_examples/sshnopwd
Normal file
24
custom-cmds-in-ubuntu/bin_examples/sshnopwd
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## sudo apt-get install -y expect
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
### USAGE
|
||||
# Type "sshnopwd USERNAME@IP PASSWORD"
|
||||
# it will loggin without asking for password nor ask to confirm the new fingerprint (if applicable)
|
||||
|
||||
set timeout 5
|
||||
|
||||
set h [lindex $argv 0]
|
||||
set p [lindex $argv 1]
|
||||
|
||||
spawn ssh -o StrictHostKeyChecking=no -t "$h"
|
||||
expect "*assword:"
|
||||
send "$p\r";
|
||||
interact
|
Reference in New Issue
Block a user