Tagged Questions
1
vote
0answers
25 views
ssh does no output when put in background
I'm trying to automate some things on remote Linux machines with bash scripting on Linux machine and have a working command (the braces are a relict from cmd concatenations):
(ssh -i ...
-2
votes
0answers
19 views
bash script to check if only header is present in csv file
This is my requirement:
I have multiple CSV files in a folder. Some CSV files have only headers and no records in it.
I have to identify such files and log the file name into log file.
Initially I ...
0
votes
2answers
34 views
Bash script trouble interpretting input
I wrote a bash script that uploads a file on my home server. It gets activated from a folder action script using applescript. The setup is the folder on my desktop is called place_on_server. Its ...
0
votes
2answers
38 views
itterate an array with ssh
I am trying to open an ssh shell then run through an array to get status on a list of expected running processes.
Here's what I have:
procList=("sdb*" 'fepkrn' 'fepcmd' 'fepmts' 'fepxml' 'fepdbs' ...
0
votes
0answers
10 views
Executing tcpdump remotely while storing packet capture locally [migrated]
I have run into stumbling block while attempting to create a bash script that will write packet capture files from tcpdump onto a remote server, while displaying the output of the tcpdump command so ...
0
votes
0answers
19 views
Imitating a shared ssh session for scripts on Windows?
I have a remote machine where I need to start a background task which talks back to a local process over a tunneled port. The problem I'm having is that the process which is to run on my local machine ...
1
vote
4answers
48 views
variable w/ spaces + ssh
EDIT:
It appears my primary issue is dealing with 'word' being empty on the remote host through every iteration of the FOR loop. The COLORS variable looks ok when I echo it, it shows all four colors.
...
0
votes
2answers
24 views
ssh-connecting to rbash won't source the .profile file
I am using libssh to connect to a remote machine and execute commands.
The connection works fine, but here's the rub: on the distant machine, the bash that is running while I'm connected is a rbash. ...
2
votes
2answers
43 views
sed over ssh connection + unknown option to `s' [duplicate]
I have a sed command in a bash script like this:
sed -i 's/db.url=.*/db.url='$URL'/' config.properties
and URL var is assigned as:
$URL=jdbc\:oracle\:thin\:@\/\/hostname\:12345\/XYZ
When I run ...
0
votes
0answers
20 views
Bash terminal lacking functionality when running as non-root [migrated]
I'm running a command-line Debian system, accessed via SSH through PuTTY, and am experiencing differing terminal functionality between root and other users.
When logging in as root, the terminal ...
0
votes
1answer
25 views
Set SSH Identities In Bashrc
I have a .bashrc file to start my ssh agent (taken from here).
Whenever I start my machine I keep having to add my identities to it (using ssh-add ~/.ssh my_private key).
Not knowing bash scripting ...
1
vote
1answer
65 views
How to open a bash/ssh session in shell script and run commands in the remote session?
I try to do the following in a shell script:
bash;
in the bash context:
run ./a.out
And In ./a.out context I need to simulate keystorkes:
yes
3292
no
How can I do it? All my tries failed ...
-1
votes
1answer
31 views
I have 120 linux serves and I want to run a script on my local workstation and return the output to a log file on my local worksation [closed]
I want to ssh in to 120 linux server cat the /etc/passwd and run some other commands. I want all output from the remote server to be appended to one file on my local work station. I have a file list ...
0
votes
2answers
29 views
How to run a script that it has to connect 3 solaris servers, do some operations and create files in the machine where the script is running?
I have to do some task of migration of three solaris servers, I have the ip addresses, username and password for each server. The script that I have to run, it does what it has to do with no problems, ...
0
votes
4answers
74 views
Provide password to ssh command inside bash script, Without the usage of public keys and Expect
I am trying to call SSH command through my script, but this script will not run to my machine.
So i have 2 limitations.
1)I can not work outside the standards of the shell,so i cant work with ...
-2
votes
2answers
50 views
How to enter ssh password using bash? [duplicate]
Everyday I am connecting to a server through ssh. I go through this routine:
IC001:Desktop user$ ssh [email protected]
[email protected]'s password:
Last login: Tue Jun 4 10:09:01 2013 from ...
0
votes
1answer
29 views
iPhone .bashrc not working properly [SOLVED]
SOLVED: I had the wrong line endings selected in my text editor
I tried to get a .bashrc going on my iPhone, just for fun. After adding source /var/root/.bashrc to my /etc/profile file I get this ...
1
vote
4answers
60 views
Bash - Escaping SSH commands
I have a set of scripts that I use to download files via FTP and then delete them from the server.
It works as follows:
for dir in `ls /volume1/auto_downloads/sync-complete`
do
if [ "x$dir" != *"x"* ...
1
vote
1answer
34 views
Git SSH access setup issue
I am currently using Cywin and had a set up working previously. Upon reinstall and redoing my setup it is no longer working.
I am following the instructions here
...
0
votes
0answers
45 views
Killing Process on Remote Host using Fabric
I am writing a script using Fabric which needs to terminate a process remotely.
(this means that the command ends up getting executed as /bin/bash command)
The current code I have is the following: ...
1
vote
4answers
80 views
Script to ssh into server automatically
I'm trying to create a script to automatically log me in to a password protected server to upload a file from an ubuntu directory automatically. I am doing this for the purposes of automatically ...
0
votes
1answer
31 views
log remotely executed commands on SSH server [closed]
How can I log the executed commands (including all arguments) on an openSSH server (in order to debug a client tool that is executing remote commands via SSH)? I haven't found the executed commands in ...
-2
votes
1answer
45 views
Run Remote Bash Script in Python
What I'm wanting to do, is run a bash script on another computer, from python. My first thought was to SSH into my remote computer with python, and run it that way. Is there any other way of running a ...
0
votes
1answer
24 views
How can I get currently attached screen session name?
I'm writing a script which needs the name of the currently attached screen session's name if there's any.
3
votes
0answers
23 views
Use bash script to copy select txt files from remote server to my local machine [migrated]
I would like this script to NOT prompt me for a password when I run it. I would like to put a password inside the script that will pass by itself. This is not a root password: It is for an account set ...
2
votes
2answers
46 views
Find available space in /tmp on a remote machine
I want to find out the available space in /tmp on a remote machine. I can do it with the following command from my machine:
ssh host-name df /tmp | awk '{ print $4 }' | tail +2`
IT works and gives ...
0
votes
2answers
44 views
SSH, execute commands as yourself [closed]
In ssh, I have often wondered if there is any way to execute commands that affect your own account rather than the one you are logged in to, or do you have to log out every time and/or open a new tab?
...
0
votes
1answer
76 views
Rsync ssh file transfer through expect showing error when executed through while loop in bash
My program needs automatic file transfer to many remote systems. So tried using expect for RSYNC SSH file transfer. While I run the .ex file through terminal providing the necessary inputs or through ...
0
votes
0answers
29 views
using expect to automatically put pubkey on server
I'm attempting to use expect as part of a client setup utility (for a unison cron job) which will automatically put their machine's pubkey on our server so that unison can continue to work over ssh ...
0
votes
3answers
74 views
-bash ruby command not found
Every time I log into my VPS I must run source ~/.bashrc before I can run any rvm, ruby, or gem commands.
Why is this? Can't make it load by default?
ssh deployer@xxx
ruby -v
-bash: ruby: command ...
0
votes
1answer
68 views
Best way to determine if an SCP transfer fails
At the end of a script if successful it creates a file (files) and stores it into a destination directory; I'm then retrieving the file (files) via scp from a server back to my workstation. The user ...
0
votes
3answers
74 views
Syntax errors when executing a complex command via ssh
I would like to know if a server is running and if not then i would like to start it. for this scenario I have written the following bash script
ssh -t machine "cd /to/the/bin/path
&& if [ ...
0
votes
0answers
25 views
SSH remote command no reading all environment variables [migrated]
I have declared some "PATH" variables in the ".bashrc" file of a remote machine. When I login to the remote machine, all these "PATH" variables work fine. But when I do a "ssh user@remote env", the ...
1
vote
2answers
26 views
Loop broken by ssh running script aside
I have a couple of machines to update some script on. I can do this with a small bash script on my side, which consists of one while loop for reading IPs from a list and calling scp for them. It works ...
3
votes
1answer
108 views
Running command via ssh also runs .bashrc? [closed]
In my reading of the bash manpage, .bashrc should only be executed when the shell is run interactively. The manpage defines interactive as:
An interactive shell is one started without ...
2
votes
2answers
68 views
Alias definition of multiple commands after ssh
I'm logging in and out of a remote machine many times a day (through ssh) and I'd like to shorten a bit the whole procedure. I've added an alias in my .bashrc and .profile that looks like:
alias ...
0
votes
1answer
93 views
Find currently connected port number SSH
i'm creating a local simulator (not connected to internet) using SSH connection. I've started sshd on a particular range of port numbers and NATing a range of devices to those. I have to find the ...
0
votes
1answer
101 views
How to execute a remote bash script from PHP
I need to execute a bash script on a remote web server from PHP. The request originates from web1 via PHP and needs to execute a bash script on another web server web2. web1 can SSH into web2 all ...
0
votes
2answers
127 views
permission denied when trying to change permissions on ssh [closed]
I am following a hadoop book that says to run this command:
sudo touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys
however i am getting
chmod: changing permissions of ...
0
votes
2answers
67 views
ssh login verification in perl
I am running following lines of code in perl script to find a df output of remote machines. this works fine and gather a info in @df_ret untill until ssh key is uptodate. if public is corrupted or ...
1
vote
1answer
56 views
Sanity check SSH public key? [closed]
I have asked users for their public "id_rsa.pub" ssh key, that I then place in "/home/theiraccount/.ssh/authorized_keys", so they can login to the server by SSH. I'd like to automate this process.
...
0
votes
1answer
68 views
Making an alias for SSH MySQL login using ENDSSH heredoc
I want to make an alias that is kept in my bashrc file to log into a remote MySQL db via SSH.
Assume that I can't add/alter any files on the remote machine that I'm SSHing into. Here's the relevant ...
0
votes
1answer
122 views
WHILE loop - read line of a file one by one — Not working the No. of times the file has lines in it
I'm using a "while" loop within a shell script (BASH) to read line of a file (one by one) -- "Fortunately", its not working the No. of times the file has lines in it.
Here's the summary:
$ cat ...
0
votes
2answers
51 views
Remote ssh command, LF missing on STDOUT
This is my first question here :)
I'm running into an issue while running a remote SSH command. The issue is that the output of the command comes back in a string without LF to delimit the lines. I ...
0
votes
1answer
122 views
Mysqldump through SSH on remote windows server using bash script
I'm trying to write a bash script to migrate database from remote server to local. One of our servers is unfortunately windows server. I installed freesshd so I can use ssh.
When I run this from my ...
0
votes
1answer
42 views
exported variable to be used on remote server
I am exporting a variable on my host, such as:
export TOPICS="A B C"
Then, I'd like to use the TOPICS variable on a remote machine via ssh, like:
ssh user@remoteHost <<EOF
for word in ...
0
votes
1answer
54 views
Why are my local commands failing to run after remote ssh commands in the same script?
I've done my homework, but I think I may be mixing apples and oranges here. My script is designed to run a remote inline series of commands, exit, and then run some additional LOCAL commands. It has ...
0
votes
1answer
106 views
Creating a shell script with config to run basic commands ssh connection with output
I'm looking at creating a small shell script with a config file where I can set the IPs of the servers that need to checked and execute a few simple commands like who, date, uname, etc. and print the ...
1
vote
3answers
53 views
Copy multiple files to multiple destinations [closed]
When copying over SSH from one UNIX system to another, is it possible to copy each file to different destinations in one operation (ie. avoid overhead of setting up a new SSH connection for each ...
1
vote
0answers
22 views
forwarding scp traffic across existing ssh tunnel without re-authentication and ssh keys [closed]
I have two machines, which we will call Machine A and Machine B, and we can assume Machine A is the host and Machine B is the guest (or target). Both machines are running sshd and I'm connecting to ...