0
votes
1answer
35 views

Changing the user after sudo - command over ssh

Im accessing my sever over SSH, with a normal user account. At some point i need to log as root, i have the root and password credentials, but when I invoke the sudo - command the prompt ask me for a ...
8
votes
4answers
680 views

`sudo echo “bla” >> /etc/sysctl.conf` permission denied

Disclaimer: I'm pretty novice at sysadmin stuff. I'm trying to set up port forwarding in an AWS EC2 instance, this has to be done in the command-line because I don't want to go in and edit anything, ...
2
votes
3answers
366 views

Rsync over SSH getting no tty present

I'm using the following command in root's crontab on Debian. rsync -vqrlHEAXogDtzhi --log-file=${LOG} --progress --rsync-path="sudo /usr/bin/rsync" --exclude-from=$CONFIG_DIR/excludes -e "ssh -i ...
2
votes
1answer
66 views

Do you need root access to fully backup a server?

I have an account on a server and I would like to automate backups onto another server, I disabled root logins for security. Do you need root access to fully backup a server?
2
votes
2answers
504 views

Configure Ubuntu to allow ssh login via pulic/private key and sudo without password

I'm setting up a fresh Ubuntu 13.04 server. I created some users and copied their public keys for ssh authentication to their home folders. Login via password will be disabled. Everything works fine ...
0
votes
1answer
86 views

How can I sudo via a remote chained command?

I am trying to run a script which executes a chain of commands under another user on a remote server. The script contains the following ssh command to return information about the remote user's Drupal ...
1
vote
1answer
105 views

Retain agent-forwarding in sudo

I want to be able to connect to a server, start a sudo shell, then use agent forwarding to connect to another server (in order to use SCP to copy files to a protected area). But: ...
4
votes
4answers
205 views

Disabling ssh as root on Linux boxes and the challenges of writing scripts

It's a common suggestion from security-minded people to disable ssh as root on Linux boxes. My question is this: Let's say you normally write lots of scripts which ssh to a large number of Linux ...
0
votes
2answers
149 views

sudoers security

I've setup a script to do Subversion updates across two servers - the localhost and a remote server - called by a post-commit hook run by the www-data user. /srv/svn/mysite/hooks/post-commit ...
0
votes
1answer
99 views

Getting permission denied error

On my Media Temple DV 4.0 server I am getting permission denied errors: -bash: cd: httpdocs: Permission denied If I switch from my login user to sudo (sudo su) or switch to root using su-, I can ...
0
votes
4answers
165 views

Need to use sudo with ssh

I'm trying to run the following comamnd as user flc: sudo hg clone git+ssh://git@github.com:flc/myproject.git /opt/flc/projects/myproject However, I'm getting this error: Permission denied ...
3
votes
1answer
248 views

Accessing SSH_AUTH_SOCK from another non-root user

The Scenario: I am running ssh-agent on my local PC, and all my servers/clients are setup to forward SSH agent auth. I can hop between all my machines using the ssh-agent on my local PC. That works. ...
1
vote
1answer
1k views

ssh remote command using password-less sudo fails

Logged on as bryan@localserver, I'm trying to perform a backup using rsync on a remote host bryan@remoteserver. I need the rsync connection to elevate privileges on the remote host using ...
0
votes
1answer
452 views

audit_log_user_command(): Connection refused when using sudo, what's wrong?

i ssh to my remote centos sever as hugemeow, then i run sudo ls, then error happens: [hugemeow@home ~]$ sudo ls **audit_log_user_command(): Connection refused** httpd hugemeow is in /etc/sudoers, ...
2
votes
1answer
651 views

x11vnc through SSH tunnel - sudo: no tty present and no askpass program specified

I'm trying to setup a one-time SSH tunnel which instantiates x11vnc on a logged-in display. ssh -f -t -L 5900:localhost:5900 user@10.1.10.1 'sudo /usr/bin/x11vnc -safer -once -nopw -display :0 -auth ...
3
votes
3answers
3k views

pass a password to sudo su

I wanted to sudo to different user after ssh'ing into remote server, for this i tried the following: cat remote-test.sh ssh -t -t abcuser@test-server.net 'bash -s' << EOF /tmp/test.sh EOF ...
2
votes
2answers
828 views

sudo prompts for password over ssh

I have sudo set up for a user (myuser) as follows on "hostname" (sudoers content): Cmnd_Alias SCRIPT=/path/script* myuser ALL=(suser) NOPASSWD: SCRIPT this works fine, so I can run the following, ...
-1
votes
3answers
266 views

Unable to Sudo into EC2 server

When i type "sudo -i" on an EC2 instance, i get following error: sudo: must be setuid root Which means that someone has tampered with the sudo permissions. Now the only way to login to server ...
0
votes
1answer
2k views

How to use sudo with WinSCP and ProFTPd?

I need to run the SFTP fileserver binary as root, but direct root login is not allowed. In WinSCP, if I use "default" on SFTP server protocol option everything works as expected. Following the ...
3
votes
3answers
113 views

SSH access and control

IS there an ideal way to limit access to server admins as to what they can and can not do with sudo? I would like to have levels of access from basic command line actions to more advanced abilities ...
6
votes
1answer
1k views

Test whether a user has sudo privileges without requiring user input

I have a local shell script that performs a number of tests on a remote host, before delivering the payload; one of these tests being whether the user has sudo privileges, checked simply with sudo -v ...
1
vote
1answer
158 views

Why can't I run ausearch (part of auditd) remotely over SSH?

Any idea why the following doesn't work? It hangs with no output. desktop$ ssh myserver "sudo ausearch -k my_key" However, the following works. It outputs the auditing history of this key from ...
2
votes
2answers
1k views

Linux: ssh to host and use sudo to run a script, runs but part of script fails

I've searched high and low for an answer to this. I have keys setup so no password is needed for the ssh into remote host. I have sudo set up with that user so that I can run the needed commands as ...
2
votes
2answers
438 views

Remotely use root over ssh for unison

I'm a little confused on how to run unison to sync files with group and owner attributes on an ubuntu system, as you need to be root. But I need to do this remotely and automated. I know I can set up ...
2
votes
2answers
704 views

run a script on remote server

I am trying to run a script on remote server as a root user. I have this line in my shell script. cat /home/myuser/create_user_updated.sh | ssh myuser@$myip "sudo sh" I get the following error. ...
2
votes
2answers
398 views

Best way to run remote SSH command requiring root, but not as root

I'm struggling with running the following command: ssh someuser@lab-test "sudo /usr/local/scripts/user.sh add tstt7777 177700007 \"Test User 06\" " Long story short I need to run the user.sh ...
5
votes
2answers
4k views

No TTY present when running commands over SSH in here-document

I'm trying to run a command over SSH like this in a here-document: ssh example.com <<END sudo /etc/init.d/apache2 reload END Which normally works except when I'm trying to run something that ...
1
vote
2answers
260 views

error deploying app with Vlad, running a sudo command, to Ubuntu server

I'm a n00b when it comes to ssh, sudo and other unix things... so bear with me, here. i've got a rails website set up and deploying with vlad via ssh already. this works fine. now i need to have my ...
1
vote
3answers
747 views

Putty: ssh root login to server disabled, how i can setup passwordless access to root on server?

For added security, we've disabled root login to server via ssh. We have a special ssh account that users need to login as, and then su as root in they require root access. How can we setup ...
3
votes
2answers
540 views

Key authentication not working when using ssh or rsync as sudo

I have ssh RSA key authentication setup between a client and an ubuntu server (following this procedure): -the RSA key authentication for ssh and rsync work fine (no need for password). -the RSA key ...
0
votes
2answers
473 views

sudo with -u via ssh -t in a crontab

I'm trying to create a cron job that uses ssh to login to a remote server and run a script as a different user. I try: * * * * * source $HOME/.keychain/$HOST-sh && sudo -u $USER ...
0
votes
1answer
299 views

Deny ssh access to user but allow keyless ssh on some servers

Redhat 4/5: Ok so here's the deal. I need to lock down my servers and only allow users to log in via their ldap account. There's an application account that everyone uses, but I would rather have ...
2
votes
1answer
2k views

How to run GUI application via ssh as another user via sudo

I have ssh configured on my server, and sometimes I have to run some graphical application on it. It works great when I connect with -X option. I can run e.g. google-chrome. However, if I change user ...
0
votes
3answers
284 views

SSH Pseudo Terminal

I'm trying to retrieve a SVN dump over a SSH connection ssh user@host "sudo -u $repo_owner svnadmin dump $repo_path" Depending on whether I already used sudo in the last 15 minutes, I have or not ...
9
votes
8answers
17k views

using su inside of a shell script

I'm automating a deploy process and I want to be able to just call one .sh file on my machine, have it do my build and upload the .zip to the server and then do a bunch of stuff on the server. One of ...
17
votes
4answers
4k views

How do I sudo over sshfs?

On my local host alpha I have a directory foo that is mapped via sshfs to host bravo as follows: $ sshfs charlie@bravo:/home/charlie ~/foo However, on host bravo there is another user, delta, that ...
1
vote
6answers
788 views

Managing servers over ssh with PermitRootLogin=no

If I can't ssh as root to each of my servers how can I make modifications in an efficient way? I am not allowed to setup ssh keys or open the sudoers file with NOPASSWD. I can't install puppet or ...
6
votes
3answers
3k views

Running 'sudo' over SSH

I'm writing a script which is to log onto a bunch of remote machines and run a command on them. I've set up keys so the user running the script does not have to type the password of each machine, but ...
2
votes
1answer
504 views

How do I skip the OTP passphrase prompt for sudo but keep it for ssh?

I've configured a server to support OTP (using opie) with ssh. What annoys me is that I get the OTP passphrase prompt even for root when doing sudo. How can I configure PAM to suppress it? Don't ...
53
votes
8answers
19k views

sudo su - username while keeping ssh key forwarding

If I have a server A into which I can login with my ssh key and I have the ability to "sudo su - otheruser", I lose key forwarding, because the env variables are removed and the socket is only ...
4
votes
2answers
1k views

Easy multi-level authentication for sudo

I have a FreeBSD server with password-based SSH enabled. I would like to enable sudo, but I do not want a potential attacker to be one password away from root access. My current solution is logging ...
5
votes
11answers
4k views

How can you prevent root password change on linux?

I'm setting up a server which other people will have sudo access to via ssh. They can install stuff and make changes as they see fit, however I still need to manage the server, install patches and ...