Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Thursday, July 20, 2017

Sledgehammer with sudo over remote hosts

dsh ls /etc/bashrc | perl -ne 'BEGIN { printf "export ss=\${1};shift;export args=\$@;" }{ $_=~s/://g;@x=split /\s+/;printf "ssh -t %s \"echo \${ss} | sudo -S -u tibcosilver \${args} \"\n",$x[0], $x[2]}' | tee out
perl -i -pe "s/#/'/g" out
echo "Please run: . out [Password]"

Tuesday, February 16, 2016

Starting a process remotely thru SSH

[user@prh01967.prod /home/user]$ cat startFlagsAgent.sh 
JAVA_HOME=/opt/java/hotspot/7/current/jre
PATH=$JAVA_HOME/bin:$PATH
nohup $JAVA_HOME/bin/java -jar ~/FlagsAgent-0.0.1-SNAPSHOT.jar -https > ~/agent.log &
pId=$!
echo "kill $pId" > ~/stop_agent.sh
chmod u+x ~/stop_agent.sh


  217  ssh userprh01628.prod 'bash -s' < ./startFlagsAgent.sh

Monday, July 6, 2015

ssh-keygen without prompts and publishing known_hosts

Self provisioning PKI infrastructure and auto registration destination known_hosts

# Generating PKI for publishing the build
ssh-keygen -q -t dsa -N '' -f /opt/jenkins/.ssh/id_dsa

# Registering the mvndev.mycompany.com target
ssh-keyscan -H destination.com,10.76.20.41 >> /opt/jenkins/.ssh/known_hosts

Wednesday, October 7, 2009

SSH Password less logon


$ pwd
/home/foouser
$ cd ..
$ ls -rtl
total 32
drwxrwsrwx 2 foouser 0 8192 Jan 23 13:57 foouser
$ chown akaan akaan
$ chmod 700 AKAAN
$ ls -rtl
total 32
drwxr-sr-x 2 foouser 0 8192 Jan 23 13:57 foouser
$ cd foouser
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .ssh
$ vi authorized_keys
~authorized_keys" [New file] 1 line, 218 characters
$ chmod 600 *
$ ls -lrt
total 16
-rw------- 1 foouser 0 217 Jan 23 14:02 authorized_keys