1
vote
2answers
82 views

How to edit /etc/hosts without sudo?

I have a machine that I can only access using SSH. I was messing with the hostnames, and now it says: ssh: unable to resolve hostname I know how to fix it in /etc/hosts. Problem is, I need sudo ...
1
vote
2answers
337 views

Why does this ssh command not work? (cat ./file | ssh <user@host> “cat | sudo -t -t 'cat > /root/location/file'”)

I'm trying to do the following but it's not quite right. cat ~/Desktop/blah.png | ssh -t -t trusktr@50.116.4.56 "cat | sudo -i 'cat | /path/to/blah.png'" I have my public ssh key in the ...
0
votes
1answer
77 views

Process substitution over ssh with sudo in Bash shell

What is the proper way to do something like this: diff <( ssh -t myuser@hosta 'sudo httpd -M') <(httpd -M) When I want to compare the output of the 2 commands, the first on a remote host the ...
1
vote
1answer
290 views

ssh with sudo doesn't start services

I want to run command with sudo through ssh without disabling "requiretty" sudo option. According to /etc/sudoers: # # Disable "ssh hostname sudo <cmd>", because it will show the password in ...
4
votes
1answer
179 views

sudo: don't ask password when logged in with ssh key

I'd like to setup sudo in such a way that it doesn't prompt me for a password when I authenticate to sshd with a key; but do otherwise. I don't want an answer of "it doesn't work like that" because ...
2
votes
2answers
110 views

Securely allowing users to create accounts

1) I'm struggling to find a secure way to allow new users to create accounts without granting them admin rights to do so. If you already have an account on my system and can work UNIX command line, ...
2
votes
1answer
170 views

How do I grant someone else access to my linux server

If you administer a Linux server, what steps do you take to properly grant someone else access? Assuming they will log in over ssh, don't already have an account, and will need root access. ...
2
votes
1answer
420 views

sudo hangs when run on remote host over ssh in a script without tty (-t)

I have an AIX 6.1 server where I need to run a remote sudo command in a bash script. Here is my bash script simplified: testSudo.sh #!/usr/bin/bash set -x sudo env I can run the sudo command ...
1
vote
2answers
738 views

How can I scp a file that my user can't read but I can sudo?

Can I use scp to copy a file from a remote server which my login user can't read, but where I have permission to sudo to root (without password even)? How?
2
votes
2answers
2k views

How to run sudo commands remotely via ssh -t?

I have a script that logs into a remote host via ssh -t and uses sudo service foo restart. The requirement is to avoid the prompt for a password on the remote host. The remote host authenticates via ...
2
votes
0answers
914 views

How to run ssh -t user@remote 'sudo nohup bash -c “comand”' in background

I want to run a script on a remote host with sudo privilege, someone suggests that I should use nohup and ssh -t, like the following command: The script ls; sleep 10; echo finish is crafted here to ...
2
votes
1answer
801 views

Getting no tty present and no askpass program specified when using git over ssh

I'm trying to push a git commit from my laptop to my server but keep getting the following error message: remote: sudo: no tty present and no askpass program specified To ...
1
vote
5answers
1k views

How to securely automate running commands as root with “sudo su -”?

hint (on client side, how to encrypt files/pwd's): # encrypt pwd with ssh key: openssl rsa -in ~/.ssh/id_rsa -outform pem > ~/.ssh/TEMP-id_rsa.pem 2>/dev/null openssl rsa -in ~/.ssh/id_rsa ...
1
vote
2answers
89 views

how to require sudo to view files?

I have a ssh server. I allow people to connect to it if they want. I do my programming homework on it. I am in trouble with my teacher because people were cheating off it. I need to know how to ...
2
votes
3answers
1k views

Run local scripts on multiple servers using sudo user through a script

I have about 100 remote servers. I want to manage all my servers using one terminal server to update , run commands with sudo privileges. I need to have one main script that takes another test script ...
0
votes
3answers
462 views

How do I execute a newly installed application with Sudo?

I have just installed an application on my Amazon EC2 instance called sshpass. I am having trouble getting it to work properly ( although, it works correctly on a non AWS instance ). I've read in ...
1
vote
2answers
3k views

SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine

I am trying to automate the deploy of some .deb packages with an script. I want to execute sudo dpkg -i $myDeb.deb in a list of remote machines I can access with ssh. I've tried to automate the ...
8
votes
5answers
9k views

Can a linux user change their password without knowing the current password?

I'm setting up a few ubuntu boxes, and using opscode's chef as a configuration tool. It would be fairly easy to install public keys for each user on each of these servers, and disable password ...
7
votes
3answers
3k views

Copying protected files between servers in one line?

I'd like to copy squid.conf from one server to another. The servers don't talk to each other. I'd like to go through my workstation. Both servers have the file, so it will be overwritten on the ...
3
votes
2answers
461 views

Why did my sudoers file suddenly reset itself?

After setting up Wave in a Box on my Debian server, I started noticing strange things happening: I could no longer use sftp to transfer files, and even worse, I couldn't run any sudo commands! ...