sudo and ssh


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users sudo and ssh
# 8  
Old 01-20-2011
If you can "sudo su - ldaprole" interactively, then when you are in the id, you can scp to pull keys into the ssh dir from your remote or local home dir using your own password, and modify any other ldaprole ssh files necessary to ssh direct from your host-account to this host-account. The access you get you already have, if you an ssh to your own account there passwordlessly, just now there is only one step.
# 9  
Old 01-21-2011
okay. Further illustrating --


Code:
/home/gy1212> ssh myhost 'sudo su - ldaprole'
The authenticity of host 'myhost (52.99.10.10)' can't be established.
RSA key fingerprint is 08:79:9c:61:ec:b5:75:8e:64:87:f8:32:7e:7c:01:dd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'myhost' (RSA) to the list of known hosts.
Enter passphrase for key '/home/gy1212/.ssh/id_rsa':
Password:password1#

ls -ltrh
total 14
-rw-r--r--   1 ldaprole gz         3.4K Dec 24 01:00 backupcontent.txt
-rw-------   1 ldaprole gz          257 Jan 10 11:51 dead.letter
drwxr-xr-x   6 ldaprole gz         1.0K Jan 18 14:43 scripts
-rw-r--r--   1 ldaprole gz          783 Jan 20 21:50 temp
id
uid=8227(ldaprole) gid=400(gz)
^CKilled by signal 2.

The issue is that it prompt me to enter password, and also it display the password as plain text. I do not want it to be prompted for a password, or at least should not display the password in plain text.

Thanks. John.

---------- Post updated at 10:05 AM ---------- Previous update was at 08:55 AM ----------

Allright, i solve it myself. i copied the my id_rsa.pub key to ldaprole, and i am not longer prompted for password.

Thanks everyone.
# 10  
Old 01-21-2011
Yes, ssh command mode has a terminal-free login, so the echo cannot be supressed there, but the echo is pprobably coming from the local stty, so turn it off using stty, first.

Or better yet, use the sudo su to log in and move the keys over, then log into ldaprole with ssh, no su!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh does not support sqlplus and sudo -i?

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... (3 Replies)
Discussion started by: h1kelds
3 Replies

2. Cybersecurity

Help on Ssh using sudo

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)
Discussion started by: anandk
1 Replies

3. Shell Programming and Scripting

Help in creating Sudo ssh script

Hi Experts, I am new to Shell scripting. I want to login to a server using a script. The normal command I use is --> sudo ssh <Servername> . when i tried putting this into a txt format file and tried running, it throw an error "can't execute". I am an Admin and i have root access. Any help would... (6 Replies)
Discussion started by: Tom1989
6 Replies

4. Shell Programming and Scripting

Ssh & sudo

when the following command is issued the command prompt is received, how do I get past this? ssh -t usera@hosta sudo su - userb -c id (4 Replies)
Discussion started by: squrcles
4 Replies

5. Red Hat

Sudo Password Prompt over SSH

I am not sure what I am missing here. I have the following identical entry in /etc/sudoers on multiple Red Hat 6.4 servers. icinga ALL=NOPASSWD:/usr/bin/yum --security --exclude\="kernel*" check-update On one server when I enter the command over SSH as follows it works fine. ssh -t -q... (1 Reply)
Discussion started by: scotbuff
1 Replies

6. Programming

Using Commands over SSH using Sudo

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)
Discussion started by: metallica1973
16 Replies

7. 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

8. UNIX for Advanced & Expert Users

ssh and sudo login

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)
Discussion started by: john_prince
5 Replies

9. UNIX for Advanced & Expert Users

sudo and ssh

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)
Discussion started by: jOOc
3 Replies

10. UNIX for Advanced & Expert Users

xwindows over ssh after sudo?

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)
Discussion started by: scottsl
3 Replies
Login or Register to Ask a Question