All Questions
14 questions
0
votes
1
answer
443
views
Correct way to set PS1 prompt over ssh
I am trying to set the PS1 prompt dynamically on the my remote machine. The idea is that when I will do ssh to the remote machine, I will also send the value which will set as a prompt for that remote ...
0
votes
1
answer
687
views
Prevent expect from hanging when running through ssh
Based on another post's answer, i managed to make expect automate vncserver through ssh (optionally on a chroot in this case), like so:
ssh user@ip "rm ~/.vnc/passwd"
echo -n "`PASS_VNC`...
0
votes
0
answers
23
views
Is it possible to carry local RSA keys to remote computer (live) and use securely?
Is it possible to store an SSH-id in some sort of session (like expect or ssh) that is running on the local machine, swing into a remote box, and execute a shell command in the remote box as if the ...
0
votes
1
answer
275
views
I need to ssh into another machine using expect and a password and start a program there, then start a program on my local machine. How can I do this?
As said in the title, I am writing a script that should run on Computer A. Computer A should ssh on Computer B, run Program B, then exit the ssh session (Program B still running on Computer B) and ...
2
votes
1
answer
3k
views
Remove carriage return (\r) from variable in expect script
Setup
Ubuntu 16.04
expect Scripts
In the simple script bellow the goal is to simply find the oldest .zip file in a directory on a remote machine using ssh.
Then use scp to download this file to the ...
1
vote
2
answers
1k
views
expect not taking ssh arguments in while/for loop
I'm trying to fetch remote machine details (dmidecode) for many hosts using some expect command.
Below is the expect script which I'm using for this purpose.
while read i; do
{
/usr/bin/expect<&...
1
vote
1
answer
2k
views
How can I update my PATH in using expect in a bash script? [closed]
I'm connecting to my university server using ssh. But, every time I log in I have to update my R PATH. So, I would like to automatize it, I have this script so far:
#!/usr/bin/expect -f
spawn ssh ...
1
vote
1
answer
2k
views
script ssh login to server and pass root password
I have written an expect script to automate the login process for ssh. My user account has rsa keys setup but once I log in I want to switch to root but the remote server is hanging on the password. I ...
0
votes
3
answers
3k
views
How to use expect in Bash script and ssh-copy-id
From a bash script:
source ./expect.sh
I am including a expect code:
#!/bin/bash
/usr/bin/expect <<EOL
spawn ssh-copy-id -i /home/user/.ssh/id_rsa.pub 111.111.111
expect '*?assword*'
send '...
0
votes
2
answers
2k
views
expect: does "" (spawn_id exp70) match glob pattern
I have written an expect script that works perfect for testing passwords on our network until it has looped through my list quite a bit, then the debug output shows that there is nothing to match.
...
2
votes
1
answer
995
views
SSH Command behaves differently in Expect Script
I'm using this command on Server1
~# ssh root@Server2 /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
to append the contents of Server2's id_rsa.pub to the authorized_keys of Server1.
It ...
2
votes
2
answers
14k
views
Bash script calls expect script with master SSH connection
I'm trying to write a bash script that calls an expect script to establish a master SSH connection to be used for the remaining SSH commands in the bash script.
~/.ssh/config:
ControlMaster auto
...
2
votes
3
answers
4k
views
How to automate connecting to multiple network devices, running a command and saving the output to a file?
I have to run a command on around 1000 network devices and save the output to a file. In a file I have a list of all the network device names that have to be connected to using SSH. I then have to run ...
3
votes
2
answers
10k
views
SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine
I am trying to automate the deploy of some .deb packages with an script. I want to execute sudo dpkg -i $myDeb.deb in a list of remote machines I can access with ssh.
I've tried to automate the ...