Hey everybody,
currently I am having an issue that I need to open an ssh session to a remote host, once on the remote host I need to use sudo and then execute sqlplus. Once the sqlplus call is open I need to execute one command while the sqlplus is active. For example show sga.
I already got so far that this is working.
With the following, the result is the same
The result is:
Now what I would like to be able to do is to get the sga values set in the DB by calling 'show sga' inside the sqlplus connection.
I already tried the following commands, which don't work:
Does anyone of you have a hint how I could solve this?
ok...I'm stumped on this one. I cannot figure out how to carry over my environment variables with a sudo command. I need to install an application under root and only have sudo access to get there. I can use ssh -Y <host> and launch an xwindows session successfully as myself but as soon as I sudo... (3 Replies)
Hello,
Can you config sudo to use the passphrase in the user ssh-key instead of the one in the passwd?
Some users do not have local passwords on the system and instead of adding the NOPASSWD in sudoers I would like the solution I asked about above.
Thx Jocke (3 Replies)
Hi,
I would like to know how i can perform a task, while performing ssh, sudo and command at the same time.
What I generally do is I ssh to the server, where i created private and public, so it does not prompt me for password all the time. Then i need to run "sudo su - ldaprole" to get into... (9 Replies)
Hi,
I am trying to execute some command, via ssh and sudo.
Here is what i want to do.
ssh localhost | sudo su - ldaprole | ls -ltrh
However, this command gives me listing of my home directory, and not of ldaprole.
If I logic directly, when i perform sudo su - ldaprole, it... (5 Replies)
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)
Is there a way to transfer my sudo password via ssh so that I can copy files remotely and pass them locally, so:
cat sudo-passwd-file|ssh -t user@10.7.0.180 'sudo find / -depth|cpio -oacv|gzip' > /path/to/dir/file.cpio.gz
I am in the process of a creating a script. Everytime I try and just... (16 Replies)
Hi Guys ,
I was facing an issue some thing like , I have to connect remote machine and should execute few commands over there , I am able to run some simple commands , but below commands are throws error like not found.
eg : sudo su - username and sqlplus user/pwd@db , srvrmgr commands etc
... (8 Replies)
I'm confused in the configuration of sudoers for one group of users.
The users need to execute a app from a remote machine, in this local machine they want me to allow ssh for them using sudo
for eg. sudo -u admin ssh -X euadmin@<IP address of remote> <remote script which opens a gui>
It... (1 Reply)
Hi Gurus,
I was trying to execute sqlplus command remotely like
ssh -q IP venkat@"which sqlplus"
am getting error as which: no sqlplus in (/usr/local/bin:/bin:/usr/bin)
if i connect manually and executing which sqlplus it working fine.
Please help to fix the issue.
Regard's
Venky (7 Replies)
Hi there,
I learnt about a case where SSH-1.99 is supported by SSH service, both SSH 1.5 and 2.0 is special.
Btw, I want to know what kind of authentication mechanism are supported by SSH, here is what I thought of:
Public/ Private Key Pair
Password Authentication (1 Reply)
Discussion started by: alvinoo
1 Replies
LEARN ABOUT CENTOS
nfstest.host
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)