Sponsored Content
Full Discussion: sudo command remotely
Top Forums Shell Programming and Scripting sudo command remotely Post 302210413 by danmero on Tuesday 1st of July 2008 01:16:42 AM
Old 07-01-2008
Please read https://www.unix.com/unix-dummies-que...om-forums.html before posting, especially rule number 5.
The basic concept is:
Code:
ssh user@host "sudo run your commands/scripts remotely..."

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remotely executing awk command

ssh user@machine awk '{ split ($1,ar,"!");print ar}' samp >samp1 Error: Unmatched '. However on <machine> awk '{ split ($1,ar,"!");print ar}' samp >samp1 executes successfully. Any suggestions. (1 Reply)
Discussion started by: bishweshwar
1 Replies

2. Solaris

Sudo for a command

I am trying to set up sudo for a command, but do not want to specify the arguments that can be passed into it. I want the user who is using sudo to be able to pass in the arguments they want. I am fairly sure I know how to do this with RBAC in Solaris 10, but for reasons I will not get into I... (1 Reply)
Discussion started by: synchro
1 Replies

3. Shell Programming and Scripting

running command remotely to populate local variable

If I run this # ssh remote-server 'du -sk /usr/platform/`uname -i`/' 174 /usr/platform/SUNW,Sun-Fire-V245 I get my output just fine, However, if i try to do the same but populate a local variable within my script called for example 'result' #!/bin/ksh result=`ssh remote-server... (3 Replies)
Discussion started by: hcclnoodles
3 Replies

4. Shell Programming and Scripting

sudo command with password

Hello everybody, Say I forgot my root password (shit happens, no?) and I'd like to brutally try 100 possibilities to delete a file using sudo. How can I make a script that tries all the passwords? The following doesn't work. Do you have a clue? foo:~$ cat test sudo rm dummy <<< 'password' echo... (1 Reply)
Discussion started by: chebarbudo
1 Replies

5. Solaris

How to securely invoke a Solaris privildged command (root) remotely?

Hi, What I would like to do "securely" is the following. From one central server invoke a script that does the following. --Store user/name passwords. (password possibly encrypted in config file) --From the central server invoke a privileged command (i.e. route add) on multiple... (1 Reply)
Discussion started by: topstuff
1 Replies

6. UNIX for Advanced & Expert Users

Sudo command

Hello, What does the below sudo command provide access to, does it allow a user to su to any other user except root. sudo !/usr/bin/su * (1 Reply)
Discussion started by: sophos
1 Replies

7. UNIX for Dummies Questions & Answers

Unable to use the Sudo command. "0509-130 Symbol resolution failed for sudo because:"

Hi! I'm very new to unix, so please keep that in mind with the level of language used if you choose to help :D Thanks! When attempting to use sudo on and AIX machine with oslevel 5.1.0.0, I get the following error: exec(): 0509-036 Cannot load program sudo because of the following errors:... (1 Reply)
Discussion started by: Chloe123
1 Replies

8. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

9. Shell Programming and Scripting

ssh execute command remotely

Hi all, Today I want to write a script to run the commands remotely. If I run the command as follows: ssh <user>@<ip> 'ls; pwd' it works fine. But when I want to use ssh to set view in clearcase, it will lose the response. as follows ssh <user>@<ip> 'cleartool setview <view_name>; pwd'... (1 Reply)
Discussion started by: Damon_Qu
1 Replies

10. Shell Programming and Scripting

How to execute command remotely as sudo and save the output locally?

Hello , I am trying to run a NetBackup command in remote server. Also this command can only be run by root so I am using sudo . Also I want the output of the command locally in a file. The below command asked for password , ran successfully and showed Output on my local server screen ... (2 Replies)
Discussion started by: rahul2662
2 Replies
csp_helper(1)							  USER COMMANDS 						     csp_helper(1)

  NAME
      csp_helper - A collection of caspar helper scripts

  SYNOPSIS
      csp_install dir (directory) file (file)

      csp_mkdircp dir (directory) file (file)

      csp_scp_keep_mode h ([user@]host) dir (directory) file (file)

      csp_sucp h ([user@]host) dir (directory) file (file)

  DESCRIPTION
      The  scripts  csp_install,  csp_mkdircp,	csp_scp_keep_mode  and csp_sucp are helpers for caspar(7). These scripts typically are not invoked
      directly, but via a Makefile which uses caspar. See the notes on	csp_PUSH  in  caspar(7)  for  information  on  how  to	link  csp_install,
      csp_scp_keep_mode and csp_sucp to caspar.

  install DESCRIPTION
      csp_install creates the required directory (if needed) and installs the file, preserving timestamps. It uses install(1).

  install EXAMPLES
       csp_INSTALL_OPTIONS='--owner=www-data --group=www-data' 
	csp_INSTALL_MODE=ugo=r 
	csp_install /srv/www index.html

       csp_INSTALL_MODE=u=rwx,go= csp_install /usr/local/sbin mkpasswd

  install ENVIRONMENT
      csp_install honors csp_INSTALL_OPTIONS and csp_INSTALL_MODE (default is u=rw,go=r).

  mkdircp DESCRIPTION
      csp_mkdircp calls mkdir(1) and cp(1).

  scp_keep_mode DESCRIPTION
      csp_scp_keep_mode  uses  ssh to copy a file to a remote host, keeping its file permission mode. The trick used is a combination of mktemp(1)
      and mv(1).  Useful if you'd like to be sure a file gets installed e.g. group writable, without fiddling with permission bits on  the  remote
      host.

  scp_keep_mode EXAMPLE
	chmod g+w rc
	csp_scp_keep_mode root@gandalf /etc/uruk rc

  scp_keep_mode ENVIRONMENT
      csp_scp_keep_mode honors csp_SSH ("ssh" by default).

  sucp DESCRIPTION
      csp_sucp calls cat(1) from within sudo(1) from within ssh(1). This allows one to copy files to accounts on hosts one can only reach by call-
      ing sudo on the ssh-reachable remote host.

      Typically, one wants to install a root-owned file, but one does not want to allow access to the root-account directly  from  ssh.  Typically
      sudo is used as an extra line of defense.

  sucp EXAMPLES
      Some examples:

	csp_sucp rms@bilbo /etc fstab

	csp_sucp monty-python commit/ trailer.txt

  sucp BUGS
      If  NOPASSWD  is	not  set in the sudoers(5) file, and one's timestamp is expired, csp_sucp will forward the sudo password prompt. The given
      password will be echoed on the console!

  AUTHOR
      Joost van Baal-Ili

  SEE ALSO
      caspar(7) The caspar homepage is at http://mdcc.cx/caspar/ .

  csp_helper 20120514						      14 mai 2012						       csp_helper(1)
All times are GMT -4. The time now is 06:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy