Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to run root level command , if user has "su -" permission in sudoers provided? Post 303043369 by MadeInGermany on Sunday 26th of January 2020 02:00:43 PM
Old 01-26-2020
That means you must exactly run sudo su -.
The following is an attempt to feed that with the desired command
Code:
for host in `cat hosts.txt`
do
  echo "###########################Server Name- $host ----Running script-Please Wait--- Please wait###########################"
  ssh -q -x -t  abc@$host "sudo su -" <<< "systemctl restart crond"
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

No utpmx entry: you must exec "login" from lowest level "shell"

Hi I have installed solaris 10 on an intel machine. Logged in as root. In CDE, i open terminal session, type login alex (normal user account) and password and i get this message No utpmx entry: you must exec "login" from lowest level "shell" :confused: What i want is: open various... (0 Replies)
Discussion started by: peterpan
0 Replies

2. Solaris

sendmail "root... User address required." error

I'm running sendmail (8.13.8+Sun/8.13.8/Submit) solaris 10. When I send mail to root at the command line (whether I use a full-qualified address or just root), I get the error message root... User address required. Sending mail to root (either at the command line or in a cron job),... (10 Replies)
Discussion started by: csgonan
10 Replies

3. Red Hat

How do I run my "SMTP" service as a root privilege ?

Friends , i want to run my smtp service as a root . let me know what r the changes i have to made to my machine . AVklinux (1 Reply)
Discussion started by: avklinux
1 Replies

4. UNIX for Dummies Questions & Answers

crontab does not run "root" job

hi, I've read different posts regarding crontab but none helped out...the shell scrip that I want to run through crontab gets run through crontab when I use the following crontab statement: 13 17 * * * /usr/net/gcc/DBdrop.sh > /usr/net/gcc/DBdrop.log 2>&1 but it does not run when I scheduel... (2 Replies)
Discussion started by: linux0004
2 Replies

5. UNIX for Dummies Questions & Answers

changing password with sudo user " permission denied"

HI All, I am using solaris i created a user adam and updated his permissions in vi sudoers file as follows adam ALL=(ALL) NOPASSWORD: ALL ........... when i create user by logging as sudo user . $ sudo useradd -d /home/kalyan -m -s /bin/sh kalyan sudo: not found ... (6 Replies)
Discussion started by: kalyankalyan
6 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Rsync is not working at root "/" level between two servers

copying daily changes from serverA to serverB using rsync(solaris8, v2.6.2) at root folder level. serverA: cd / rsync -a -vv --delete --checksum --sparse --stats --dry-run --exclude /tmp/ --exclude /proc/ --exclude /devices/ . root@<IP of ServerB>:/ This is generating mainly three debug... (0 Replies)
Discussion started by: kchinnam
0 Replies

8. AIX

Change "root" to "root.admin" in outgoing e-mails

Our AIX servers send e-mails which have the "from" address set to "root@company.com" for our root user ("C{M}company.com" in /etc/sendmail.cf). The problem is that when bad e-mails are sent out or rejected by remote servers, they are being returned and delivered to e-mail box of "Mary Root". ... (2 Replies)
Discussion started by: kah00na
2 Replies

9. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

10. Shell Programming and Scripting

Permission error when "touch"ing file with different user

Hi, There are 2 users (T886072 & T864764) that need to be provided full (rwx) access to a directory. I made the changes to the directory permissions using chmod and setfacl : root@digidb2:# chmod 700 /u02/ftpfiles/MFRS16/discount_rates/ root@digidb2:# setfacl -s... (3 Replies)
Discussion started by: anaigini45
3 Replies
NFSTEST.HOST(1) 						nfstest.host 1.0.1						   NFSTEST.HOST(1)

NAME
nfstest.host - Host module DESCRIPTION
Provides a set of tools for running commands on the local host or a remote host, including a mechanism for running commands in the back- ground. It provides methods for mounting and unmounting from an NFS server and a mechanism to simulate a network partition via the use of 'iptables'. Currently, there is no mechanism to restore the iptables rules to their original state. CLASSES
class Host(baseobj.BaseObj) Host object Host() -> New Host object Usage: from nfstest.host import Host # Create host object for local host x = Host() # Create host object for remote host y = Host(host='192.168.0.11') # Run command to the local host x.run_cmd("ls -l") # Send command to the remote host and run it as root y.run_cmd("ls -l", sudo=True) # Run command in the background x.run_cmd("tcpdump", sudo=True, wait=False) .... .... # Stop command running in the background x.stop_cmd() # Mount volume using default options x.mount() # Unmount volume x.umount() Methods defined here: --------------------- __init__(self, **kwargs) Constructor Initialize object's private data. host: Hostname or IP address [default: localhost] user: User to log in to host [default: ''] server: NFS server name or IP address [default: None] nfsversion: NFS version [default: 4] minorversion: NFS minor version [default: 1] port: NFS server port [default: 2049] export: Exported file system to mount [default: '/'] mtpoint: Mount point [default: '/mnt/t'] datadir: Data directory where files are created [default: ''] mtopts: Mount options [default: 'hard,rsize=4096,wsize=4096'] interface: Network device interface [default: 'eth0'] nomount: Debug option so the server is not actually mounted [default: False] iptables: Iptables command [default: '/usr/sbin/iptables'] sudo: Sudo command [default: '/usr/bin/sudo'] mount(self, **kwargs) Mount the file system on the given mount point. server: NFS server name or IP address [default: self.server] nfsversion: NFS version [default: self.nfsversion] minorversion: NFS minor version [default: self.minorversion] port: NFS server port [default: self.port] export: Exported file system to mount [default: self.export] mtpoint: Mount point [default: self.mtpoint] datadir: Data directory where files are created [default: self.datadir] mtopts: Mount options [default: self.mtopts] Return the mount point. network_drop(self, ipaddr, port) Simulate a network drop by dropping all tcp packets going to the given ipaddr and port using the iptables commands. network_reset(self) Reset the network by flushing all the chains in the table using the iptables command. run_cmd(self, cmd, sudo=False, dlevel='DBG1', msg='', wait=True) Run the command to the remote machine using ssh. There is no user authentication, so remote host must allow ssh connection without any passwords for the user. For a localhost the command is just executed and ssh is not used. The object for the process of the command is stored in object attribute 'self.process' to be used by methods wait_cmd() and stop_cmd(). The standard output of the command is also stored in the object attribute 'self.pstdout' while the standard error output of the command is stored in 'self.pstderr'. cmd: Command to execute sudo: Run command using sudo if option is True dlevel: Debug level for displaying the command to the user msg: Prefix this message to the debug message to be displayed wait: Wait for command to complete before returning Return the standard output of the command and the return code or exit status is stored in the object attribute 'self.returncode'. stop_cmd(self, process=None, dlevel=None, msg='') Terminate command started by run_cmd() by calling wait_cmd() with the 'terminate' option set to True. process: The object for the process of the command to terminate, or terminate all commands started by run_cmd() if this option is not given dlevel: Debug level for displaying the command to the user, default is the level given by run_cmd() msg: Prefix this message to the debug message to be displayed Return the exit status of the last command sudo_cmd(self, cmd) Prefix the SUDO command if effective user is not root. umount(self) Unmount the file system. wait_cmd(self, process=None, terminate=False, dlevel=None, msg='') Wait for command started by run_cmd() to finish. process: The object for the process of the command to wait for, or wait for all commands started by run_cmd() if this option is not given terminate: If True, send a signal to terminate the command or commands and then wait for all commands to finish dlevel: Debug level for displaying the command to the user, default is the level given by run_cmd() msg: Prefix this message to the debug message to be displayed Return the exit status of the last command Static methods defined here: ---------------------------- get_ip_address(host='', ipv6=False) Get IP address associated with the given host name. This could be run as an instance or class method. SEE ALSO
baseobj(1) BUGS
No known bugs. AUTHOR
Jorge Mora (mora@netapp.com) NFStest 1.0.2 10 April 2013 NFSTEST.HOST(1)
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy