0
votes
0answers
24 views

Bash Script Display Remote Screen Session to User

I'm kind of new to bash scripting and I'm having trouble figuring out how to accomplish this. I'm working on a script that is designed to backup and manage a java application that runs within a ...
0
votes
1answer
28 views

end child process on network timeout

I have a .NET program (Edit: using MONO), call it myfoo that resides on my remote ubuntu server. To access it, I ssh into my box (using wifi, not ethernet). My bash shell starts up as normal, I cd ...
1
vote
2answers
35 views

SSH TERM detection

My ssh config file has accept env set as: AcceptEnv LANG LC_* I am a bit confused how when I ssh through some clients my TERM variable is set as xterm256-color, and other clients TERM is set as ...
0
votes
0answers
19 views

How to detect the OS type of a SSH client from the remote OS

If I am using PuTTY from Windows to SSH to a remote OS, how do I detect what OS the SSH client is running on, from within the remote OS? I think this is probably impossible. Merely the terminal type ...
1
vote
1answer
45 views

How do I change the .bash_history file location?

I'm running CentOS 6.x and want to move the .bash_history to a different location. The home directories of my users are (because I run a VPS) in /var/www/vhost/<domain>.<tld> which is FTP ...
0
votes
1answer
32 views

Linux Bash SSH - Why won't my port forwarding tunnel command work?

The commands I'm trying are: ssh -vxNn -L 8080:192.168.x.xx:80 hostname@server ssh -vxNn -L 8080:192.168.x.xx:80 hostname@server Where the "x" is masked for security as is the hostname and server, ...
1
vote
1answer
54 views

sequential SSH command execution not working in Ubuntu/Bash

My requirement is I will have a set of commands that needs to be executed in a text file. My Shell script has to read each command, execute and store the results in a separate file. Here is the ...
0
votes
0answers
21 views

Connecting to ssh and using screen not working properly

I used once ssh -t <login@server> screen -R to connect to a server and everything worked fine. I used the terminal in the server to execute an script and then detach the screen. I came back ...
3
votes
1answer
63 views

Why does my .bashrc get read when I run noninteractive commands over ssh

I've prepended each of my bash config files (~/.bashrc,~/.bash_profile,~/.profile) with echo NAME_OF_FILE, i.e. I get '.bashrc' when I source in ~/.bashrc. What baffles me is why I get and ...
1
vote
1answer
46 views

SSH hang at the end of one command

Below command is not coming out : ssh -x -l root asr-bng-ubuntu "/usr/local/sbin/radiusd" But process is getting started when i checked in console. Able to execute same ...
0
votes
1answer
63 views

Running a script from ssh, logging out and continuing the script

The overall question here is - how do I automate sshing into a machine, running a script, and exiting without killing the script? I know that this has been answered several times, but I'm not having ...
1
vote
1answer
123 views

SSH setting a timeout for the 'password' prompt?

Is there an SSH option (similar to -o ConnectTimeout=$seconds) that limits the time that it spends waiting at a password: prompt? Note, I do use keypairs for passwordless ssh, but I still wind up ...
1
vote
3answers
62 views

start program via SSH as different user

Problem description: there are two Macs, #2 one logged in with exampleuser and #1 I am logged in as admin. exampleuser doesn't have SSH rights at all, as it isn't an administrator. admin has full ...
0
votes
1answer
84 views

How do you run a command as another user on Linux?

I have access to a linux server where I can sudo to 'foo' like this without a password: sudo su - foo Once I am the 'foo' user I am able to run a script like this: /dir/foo_user_script.sh The ...
1
vote
2answers
545 views

ssh without password from a bash script

I am writing a bash script that should start a serf agent(http://www.serfdom.io/intro/index.html) on a remote machine via ssh. I have set up rsa keys using... ssh-key-gen -t rsa -b 4096 ssh-copy-id ...
0
votes
1answer
26 views

Live CD: Script doens't work correctly after login

I have a PXE/NFS Server (192.168.1.10), a client PC and a diskless PC. I installed base ubuntu 12.04 to client PC. I wrote this script (update.sh) to work after login to client PC. ...
0
votes
2answers
27 views

How to delete Exported folder (SSH)

I have used command: export TMPDIR=$HOME/tmp Now it created /tmp folder in my root directory (root/tmp) How can i delete it?
0
votes
1answer
39 views

Bash provide options and pass variable on choice

Trying to give an option to users of an installer to chose either "Development" or "Stable". By default the installer does "git checkout 1.1.0", but I'm turning 1.1.0 into $GIT_VERSION and trying to ...
2
votes
4answers
89 views

Manage a few Linux servers at once

I have a small cluster that consists of a few Linux nodes. There's a shared NFS, and I have the same user account with shared SSH keys on all nodes, but other than that each node has it's-own file ...
1
vote
1answer
94 views

break: only meaningful in a `for', `while', or `until' loop

Troubleshooting a error output at the end of a script. This... # We now request that the user restarts their server... read -e -p "Restart your server now to complete the install (y/n)? " rsn ...
5
votes
3answers
1k views

Could not create directory '/var/empty/.ssh'

Every day, after several hours of use, anything using SSH will just randomly stop working. The only solution is for me to restart my machine, which fixes it until it randomly occurs again. > git ...
0
votes
1answer
36 views

Tell me, when script has finished

Some years ago I had a small script[1] called beep-forever which ringed the terminal bell for ever. Use case: I want to know if a script has finished: do-foo-which-lasts-ten-to-thirty-minutes.sh; ...
1
vote
0answers
51 views

Cron deamon written in shell

I'm looking for a script in bash or ksh, that would do ... more or less ... the same as crond. The situation is, that our system administrator suddenly denied the use of crontab to all regular users ...
0
votes
3answers
129 views

Continue SSH background task/jobs when closing SSH or when Shell is disconnected

I am running an MPI program with SSH secure shell. Due to Wi-Fi disconnection, my la[top looses connection with server and causes failure of running process at server. As per above suggested ...
0
votes
1answer
89 views

osx - change terminal-color based on user

what i want to achieve : everytime i log onto a machine via ssh with a specific user -> "danger" like ssh danger@somehost i want the terminal to change its background to red, so i have a visual ...
2
votes
2answers
823 views

Putty: login, execute command/change environment variable, and do NOT close the session

I would like to configure my PuTTY session in such a way that I could login to a remote host, and (a) start bash (b) change the PS1 variable (prompt content) (c) continue work in the session as ...
9
votes
1answer
193 views

Security concerns of displaying ssh private key

I've made I huge mistake, or at least I think it is: I've "catted" my private SSH key cat ~/.ssh/id_rsa I'm now afraid that I've created a security hole, allowing other users to see my private key ...
0
votes
1answer
806 views

How to exit SSH of vagrant in terminal

Following the README in this repository, I am supposed to secure shell my way into a virtual machine I've created, but once I've done so, how do I get out? Here are the instructions: $ git clone ...
0
votes
1answer
182 views

Detach from local tmux session to attach to remote tmux?

I currently have my new Konsole instances pop up already within a tmux session, whether new or attached, since tmux is awesome and you should always be inside tmux, right? However, this puts me in a ...
3
votes
1answer
167 views

How to prevent SSH from disconnecting if it's been idle for a while

I have a ssh connection to a machine which gets disconnected by that machine after 30 minutes of no user input. However, if I start something like top, the connection stays alive. Since this is a ...
0
votes
2answers
43 views

Is it possible to get SSH to forward empty arguments?

I'm trying to execute a remote script with SSH, and this script changes its behavior depending on whether or not a specific argument is empty. Here's a minimal example, where I created a simple tmp.sh ...
0
votes
1answer
63 views

Log in using SSH without password

On my server, I've got openssh-server and a special account without password. I'm creating a shell script, that must be used without user input. For example $(ssh dummyUser@dummy.com) I need script ...
0
votes
1answer
89 views

Modify persistent variables on a remote server host using 'ssh' from client host

As the title says, I want to modify environment variables on a remote server using 'ssh'. My first attempt was: $ ssh mysvr -l sikaiwei "getId=$ORANGE; echo $ORANGE; ORANGE=$((ORANGE+1)); echo ...
1
vote
2answers
159 views

Shell script to show online users

I know it's an amateur question. I need to write a Bash shell script which count how many users are online at the moment on the SSH server. I need to ignore multiple logins and show the username and ...
0
votes
1answer
94 views

How to properly open a SSH tunnel for a program and close it afterwards?

I want to run a command that needs a SSH tunnel for its operation (opening TCP connections repeatedly). After it exists, the tunnel needs to be closed again. The problems I encountered are: I can ...
0
votes
1answer
405 views

How to check if a file exists on a remote server

I want to test if a file exists somewhere on a remote Linux server (e.g., /var/run/test_daemon.pid), without logging in to the server interactively. For example, you may want your script to behave ...
0
votes
1answer
54 views

Is it possible to automatize a shared host setup using bash shell script?

Preamble: Never created a shell bash script before. So, and first of all, I'm not even sure if this IS the right tool for the job. If it isn't, please, and before all, let me know what, in your ...
2
votes
1answer
65 views

Export bash function over SSH

I would like to export a bash function over ssh to use it in GNU parallel. That question seems to be answered here Exporting bash functions through ssh but I don't seem to be able to get it to work. ...
1
vote
2answers
209 views

Restrict user access to only read from /proc

As a method for setting up some bare-bones systems monitoring, I have a script set up to SSH in, and run some basic shell commands, reading some files in /proc. I would like to create a specific user ...
9
votes
5answers
528 views

Is there a command in Linux which waits till it will be terminated?

I'm trying to build a Windows batch file, which starts putty/plink with port forwarding, and nothing else. The Windows part is ready so far: start plink.exe -ssh -i key.ppk -L 1234:localhost:80 ...
0
votes
2answers
804 views

Linux: ssh command works outside bash script, but not within script?

I am having problem with the following command: echo "Pass for router:" read -s pass /usr/bin/expect - << EXPCT spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt ...
-2
votes
2answers
55 views

Shell variables. I'm new at this and having diffulculty

If the shell variable x has the value 5, and you reassign it with x="expr $x + 10", what is the new value of x?  What would have been the value if single quotes were used instead?  What is the most ...
0
votes
2answers
67 views

Logging in over ssh in a different session?

I don't know exactly what the correct term is, but I notice if I log in to a remote SSH server, then close the window, open a new one, and log into that server again, my bash history and user ...
0
votes
1answer
489 views

su in shell script started from ssh works in other terminal

Sorry my dumb question but I don't know how to describe my situation. There are logs from Jenkins: ssh www.myserver.com '/var/lib/tomcat7/webapps/deploy_webapp.sh' + id uid=1004(jenkins) ...
1
vote
1answer
115 views

Tab title is wrong with ssh/screen on osx

I am doing ssh -t host screen -D -RR in OS X (10.9) terminal tabs. My ~/.screenrc is identical on all remote hosts and contain the following line: hardstatus string "%H(%n:%t)$USER %h" My ...
2
votes
0answers
98 views

How can I tell what command is running on the remote end of an ssh connection?

Tl;dr - how do I find the name of the command (eg $BASH_COMMAND) running on the remote end of an ssh connection? ... My example setup is two tmux vertical panes, LH pane runs a local vim session ...
0
votes
3answers
763 views

How to keep variable preserve while running script through ssh

I am trying to run while loop with read through ssh: #!/bin/bash ssh root@10.10.10.10 "cat /var/log/syncer/rm_filesystem.log | while read path; do stat -c \"%Y %n\" "$path" >> ...
1
vote
4answers
327 views

Problems when loop over a series of ssh-ed commands

I have a series of server machines which I want to run the same command on. Each command takes hours and (even though I am running the commands using nohup and setting them to run in the background) ...
1
vote
2answers
791 views

SSH session hangs when trying to open a shell

Since this morning I cannot login normally on my server using SSH anymore. Typically, when typing this: ssh foo@bar.org The shell hangs and does not acquire shell. The last line of verbose with ...
1
vote
3answers
4k views

How to ssh with username AND password linux

Im trying to ssh with the Username AND password provided. Restrictions: 1. I DO NOT want to have to set up a public key for each of the servers I am trying to ssh into. 2. I DO NOT want to/have ...