PDA

View Full Version : Utenti sudo


texerasmo
28-07-2006, 18:32
Ciao a tutti
allora

nel file /etc/sudoers ho messo la seguente riga

snetoport bsd = NOPASSWD: /etc/init.d/Apache_EYE


il file /etc/init.d/Apache_EYE contiene


#!/bin/sh
case "$1" in
start)
echo -n "Avvio di Apache2: "
/usr/local/apache2/bin/apachectl start
echo
;;
stop) echo -n "Arresto di Apache2: "
/usr/local/apache2/bin/apachectl stop

echo
;;
*)
echo "utilizzo: Apache2 (

START|STOP


)"
exit 1
esac

A questo punto pensavo che snetoport aveva i privilegi di far partire questo script ma non è cosi.
Potete aiutarmi?

PiloZ
28-07-2006, 21:48
così è ovvio che non ha i privilegi :)
imposta lo script Apache_EYE con i permessi 751
poi in sudoers permetti l'eseguzione di apachectl e non di Apache_EYE (che di default lo puoi già eseguire con snetoport) e riprova.

Ciao :)

texerasmo
31-07-2006, 11:59
-rwxr-x--x 1 root root 496442 4 apr 15:03 ab
-rwxr-x--x 1 root root 3091 4 apr 15:03 apachectl
-rwxr-x--x 1 root root 6621 4 apr 15:03 apr-config
-rwxr-x--x 1 root root 5553 4 apr 15:03 apu-config
-rwxr-x--x 1 root root 22800 4 apr 15:03 apxs
-rwxr-x--x 1 root root 44900 4 apr 15:03 checkgid
-rwxr-x--x 1 root root 8694 4 apr 15:03 dbmmanage
-rwxr-x--x 1 root root 796 4 apr 15:03 envvars
-rwxr-x--x 1 root root 796 4 apr 15:03 envvars-std
-rwxr-x--x 1 root root 560845 4 apr 15:03 htdbm
-rwxr-x--x 1 root root 506190 4 apr 15:03 htdigest
-rwxr-x--x 1 root root 508288 4 apr 15:03 htpasswd
-rwxr-x--x 1 root root 2930458 4 apr 15:03 httpd
-rwxr-x--x 1 root root 47269 4 apr 15:03 logresolve
-rwxr-x--x 1 root root 381367 4 apr 15:03 rotatelogs



-rwxr-x--x 1 root root 321 28 lug 17:47 /etc/init.d/Apache_EYE



visudo -f /etc/sudoers

snetoport bsd =/usr/local/apache2/bin/apachectl start

Ho provato ma mi da sempre

[snetoport@www bin]$ /usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl: /usr/local/apache2/bin/apachectl: Permission denied


Ho dimaneitcato qualche passaggio

texerasmo
31-07-2006, 12:13
l'errore è questo

[snetoport@www bin]$ ./apachectl start

./apachectl start
(13)Permission denied: make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs

texerasmo
31-07-2006, 15:06
Non mi funziona nemmeno con il reboot

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification
Host_Alias SERVER = localhost

# User alias specification
User_Alias SERVIZI = snetoport

# Cmnd alias specification
#Cmnd_Alias APACHEEYE = /usr/local/apache2/bin/apachectl start
Cmnd_Alias APACHEEYE = /sbin/reboot


# Defaults specification



# User privilege specification
root ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now

SERVIZI ALL = APACHEEYE



[root@www root]# su - snetoport
[snetoport@www snetoport]$ /sbin/reboot
reboot: must be superuser.