• [^] # Re: Oui, c'est possible

    Posté par . En réponse au message Créer un bouton qui lance Apache. Évalué à 1.

    Tu veux plus d'infos:
    On repart au début:

    Visudo:

    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    # Failure to use 'visudo' may result in syntax or file permission errors
    # that prevent sudo from running.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #
    #login ALL=(root) NOPASSWD:/etc/init.d/httpd, /etc/init.d/mysqld

    # Host alias specification

    # User alias specification
    User_Alias STAFF=sacha
    # Cmnd alias specification

    # Defaults specification

    # Runas alias specification

    #test
    #login ALL=(root) NOPASSWD:/etc/init.d/httpd, /etc/init.d/mysqld
    # User privilege specification
    root ALL=(ALL) ALL
    STAFF 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
    #%STAFF ALL=(root) NOPASSWD:/etc/init.d/httpd, /etc/init.d/mysqld

    # Samples
    # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
    # %users localhost=/sbin/shutdown -h now
    login ALL=(root) NOPASSWD:/etc/init.d/httpd, /etc/init.d/mysqld


    j'ai ensuite créer un fichier /bin/allumageapache.sh
    dans lequel j'ai rajouter:
    #!/bin/bash
    /etc/init.d/httpd start
    /etc/init.d/mysqld start



    puis adapter les droits du script
    enfin je lance la commande
    sudo allumageapache.sh
    et il me demande dans tout les cas le mot de passe sans message d'erreur.

    P.S.: un trouve plusieurs fois la ligne
    #login ALL=(root) NOPASSWD:/etc/init.d/httpd, /etc/init.d/mysqld
    ce sont les différents endroit ou j'ai essayé.

    j'ai aussi essayé:
    %STAFF ALL=(root) NOPASSWD:/etc/init.d/httpd, /etc/init.d/mysqld

    enfin si j'esssaye sans sudo:
    [sacha@localhost ~]$ allumageapache.sh
    Starting httpd: (13)Permission denied: make_sock: could not bind to address 127.0.0.1:80
    no listening sockets available, shutting down
    Unable to open logs
    [�CHEC ]
    ls: ne peut ouvrir le r�pertoire /var/lib/mysql/mysql: Permission non accord�e
    Initializing MySQL database:
    Installing MySQL system tables...
    091202 19:20:22 [Warning] Can't create test file /var/lib/mysql/localhost.lower-test
    091202 19:20:22 [Warning] Can't create test file /var/lib/mysql/localhost.lower-test
    091202 19:20:22 [Warning] One can only use the --user switch if running as root

    ERROR: 1347 'mysql.db' is not BASE TABLE
    091202 19:20:22 [ERROR] Aborting

    091202 19:20:22 [Note] /usr/sbin/mysqld: Shutdown complete

    Installation of system tables failed!

    Examine the logs in /var/lib/mysql for more information.
    You can try to start the mysqld daemon with:
    /usr/sbin/mysqld --skip-grant &
    and use the command line tool
    /usr/bin/mysql to connect to the mysql
    database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables

    Try 'mysqld --help' if you have problems with paths. Using --log
    gives you a log in /var/lib/mysql that may be helpful.

    The latest information about MySQL is available on the web at
    http://www.mysql.com
    Please consult the MySQL manual section: 'Problems running mysql_install_db',
    and the manual section that describes problems on your OS.
    Another information source is the MySQL email archive.
    Please check all of the above before mailing us!
    And if you do mail us, you MUST use the /usr/bin/mysqlbug script!
    chown: ne peut lire le r�pertoire `/var/lib/mysql': Permission non accord�e
    chmod: modification des permissions de `/var/lib/mysql': Op�ration non permise
    Starting MySQL: /etc/init.d/mysqld: line 165: kill: (17449) - Aucun processus de ce type
    [�CHEC ]