33
votes
8answers
3k views

How can I run arbitrarily complex command using sudo over ssh?

I have a system that I can only log in to under my username (myuser), but I need to run commands as other user (scriptuser). So far, I have come up with the following to run the commands I need: ssh ...
1
vote
1answer
198 views

Allow normal user to run PHP script as root using SUDO

How can I allow a normal user on Ubuntu to run php scripts? sudo php /path/to/script/script.php Basically the script needs to be run as root but the users does not have root privileges on their ...
4
votes
4answers
215 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 ...
2
votes
2answers
2k 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 ...
3
votes
4answers
363 views

Prevent sudo, apt-get, etc. from swallowing pasted input to STDIN?

I often write up wiki instructions to install various server packages on Ubuntu (11.10 Oneiric at the moment). They always involve things like: sudo apt-get install -y postfix sudo cp ...
0
votes
1answer
101 views

bind shell program to user as root

I have an embedded system I have been developing. I would like to bind a program called HHPConfig, which I wrote and needs root permissions for setting network interfaces, rebooting etc..., to a user, ...
2
votes
3answers
2k views

Password less sudo in script

I have passwordless access to a server. My user account has added in sudoers file for NOPASSWD usage for some services/daemons in /etc/init.d/. I want to write a script to start or stop a daemon ...
10
votes
3answers
849 views

Temporarlly increasing sudo's timeout for the duration of an install script

I'm trying to write a script, that will install a bunch of software, I'd like to not have to run everything as root, so I'd like to be able to prompt for a password and then go about the install, ...
1
vote
3answers
470 views

Passing variables problem - Bash

I have a following problem: #!/bin/bash NUM=`cat accounts | wc -l`; for i in {1..$NUM} do account=`awk "NR==$i" accounts`; echo -e "\nAccount: $account\n"; sudo ./backup_maildir $account; ...
3
votes
3answers
561 views

Write shell script that can only be run by a sudo user in Ubuntu

I'm writing a shell script that is supposed to be run by users only in sudo user list, what's the appropriate way of doing this? what I'm thinking is in the shell script, try to create a dummy file ...