0
votes
2answers
53 views

Bash script to enable / disable SSH

Im running ubuntu 14.04 LTS (no GUI) and im looking to write a bash script that does the following: Check to see if the ssh service is enabled or disabled If enabled, then disable, if ...
1
vote
1answer
44 views

How to Start Program After SSHD is Up and Running

I'm working on a project that requires I start a GUI before the login prompt. I had this working under 12.10, but today I migrated to 14.04 and it's breaking stuff. At this point I've configured Grub ...
0
votes
4answers
71 views

SSH remote command execute stays without disconnect when finished execute?

I am trying to build a script/command that will restart our Asterisk/Elastix service on our PBX. The script is basically using simple command with auto log-in public key that run from Ubuntu ...
3
votes
1answer
202 views

How do I pass complicated shell commands over SSH to be executed remotely? Mine throw syntax errors or get interpreted locally!

I have a command like this which tells me if a system has a disk that's getting full (>=70% full): if [[ -n df -PTh|column -t|awk '{print $6 $7}'|awk -F"%" '{printf "%-9s %-5s\n",$1,$2}'|grep -v -e ...
0
votes
2answers
107 views

Start-up / Reboot scripts for different users

I'm still trying to learn a little more about bash scripting and start-up / reboot, I have read about crontab @reboot and also just looking at other options but I just wondered if someone could maybe ...
1
vote
1answer
124 views

piping using ssh without having to relogin for every pipe

I have an ssh connection and I have to send some local files and output to the ssh server. I know I can do this using the following command tar zcf - stuff | ssh user@server 'tar zxf -' I would ...
0
votes
2answers
3k views

Run scripts automatically in server after ssh connection

how to run a script automatically in server soon after client system establish ssh connection with the server for ex: suppose a user will logon to my computer from another system(connected via lan) ...
0
votes
1answer
907 views

SSH - How to force execution of a script ( /etc/sshrc , ForceCommand, .. ? ) on login but still allow execution of the client's ~/.ssh/rc?

As far as i know upon SSH login the following files are executed [SERVER] /etc/environment [Client] ~/.ssh/environment -> can be locally overriden by "SSH_ENV" environment variable -> will ...
4
votes
1answer
14k views

Run a nohup command over SSH, then disconnect

I want to execute a script, start.sh on a remote server which runs this: nohup node server.js & Naively, I call SSH like this: ssh myserver <<EOF ./start.sh & EOF This starts the ...
3
votes
1answer
8k views

Run script at boot/startup in Ubuntu 12.04 x64 Server

I am trying to start the RoR application named fedena. What I generally do is SSH login as rootand hit these commands root@cloud:~# cd fedena root@cloud:~/fedena# script/server => Booting WEBrick ...
0
votes
1answer
241 views

how to use expect with bash

I Have created a shell script as given below.This script will login to a remote server as a normal user then switch to root user for creating a directory.The script is as given below. ssh -t ...
1
vote
1answer
391 views

How to keep X-Server running via 'ssh -Y' after closing shell?

my name is Chris and i have trouble to run a Python-Script on a Server. I try to run a Python Script, that makes use of the Python module wx, on a Server. Therefor i open a shell connect to the ...
0
votes
0answers
42 views

Can I store a password in a bash script? [duplicate]

Is there some way to store (for example hashed etc.) secured password in a script that will be used during connection to server? Storing password and username as clear text in code for me is quite ...
1
vote
1answer
3k views

Script to establish SSH tunnel and then run another program that uses the tunnel

I am running a GUI app (Gnucash) that connects to a remote Postgres database via a secure shell session. I can use the SSH -L command to tunnel a local port and then separately run Gnucash and this ...
1
vote
1answer
124 views

Multiple Users Sending Input To The Same Server Running On My Ubuntu Server

I've just recently started hosting a Java based server on my Ubuntu Server. I've been learning how to setup everything and I've been feeling pretty good about it's setup. I currently start the ...
2
votes
2answers
144 views

scripts in ~/bin don't work when connecting through ssh

I have some script in my $HOME/bin folder. When I access my machine remotely I can't use them and I can't understand why. They work just fine when I'm in front of my remote computer. I think it might ...
4
votes
1answer
238 views

How to stop SSH filesystem from discarding root permissions after every command?

i have a small bash script that mounts my sshfs... problem is it ask for the server/host password for every mount... i have four mounts and i have to enter it every time for 4 times and its ...
32
votes
2answers
39k views

ssh: automatically accept keys

I've written this small utility script: for h in $SERVER_LIST; do ssh $h "uptime"; done When a new server is added to $SERVER_LIST, the script is stopped with: The authenticity of host ...
3
votes
2answers
2k views

How to automatically run commands on SSH connection?

I have some Amazon EC2 instances that run Ubuntu 10.04.1 LTS. Every time I connect to those instances I run a couple of simple commands, like a cd <repository>, a git status etc. How can I add ...
1
vote
2answers
3k views

Copy file to same directory with appended filename Via SSH Bash Script

How would I copy a batch of files into the same directory with an appended filename via SSH Bash Script? For example. /path/files/file /path/files/file-20120105 The trick is for it to be a one liner ...
2
votes
2answers
1k views

How to pass arguments in a script using gnome-terminal

As part of a script I have gnome-terminal -e "process involving another user" Once executed this line, I have to write in the terminal 3 times the password of this user. I wonder how can I automate ...
1
vote
1answer
267 views

Executing bash script for all users

I have setup-ed key based ssh authentication to all my hosts for root user. However, for example if i want to change the background of all the users (not the root user, different user account) how to ...
0
votes
1answer
478 views

What command can mount an SSH share and launch a file?

I have a file on another Ubuntu machine. I want to access it from my machine on my LAN. I don't want to go into Nautilus to mount the share first and then browse to the file. I want a command that ...
1
vote
3answers
4k views

SFTP upload script, there is no key

I need to upload a file to a server. The server uploads using SFTP. After authentication, any command execution is forbidden, so I cannot SSH directly in, I need to get directly into the SFTP ...
3
votes
2answers
7k views

Remotely run a command on a ssh-server with a script

I want to run a command on a ssh-server, but this command is determined by a script on my local machine. How do I do that? An example for clarity: I want to write a script here (foo.sh) that takes an ...
6
votes
3answers
7k views

Run (system) script on SSH login and/or logout

I'd like my OpenSSH server to start a script whenever a user logs in using SSH, ideally passing the host name or IP, as well as the user name. Additionally I'd like it to run a script, whenever a ...
1
vote
2answers
732 views

connecting and copying files with scp — ubuntu 10.04

I have a work computer. I have a home computer. I want to be able to share files between with scp, both our computers are behind routers, which assign a local ip. 198.168.0.* As well as knowing their ...