Bonjour a tous,

J'ai un petit pepin avec la commande psql. Je ne parviens pas a executer la commande psql a partir d'un utilisateur de session autre que postgres(utilisateur de session et utilisateur de la base postgres).

Envirronement :
Debian
- Utilisateurs de session : root, postgres, nobody, www-data, kem
Postgresql
- Users : postgres

mon sudoers

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
 
# Host alias specification
#Host_Alias ICI = localhost
 
# User alias specification
User_Alias ROOT_FRIENDS = nobody, postgres, kem, www-data
 
# Cmnd alias specification
Cmnd_Alias SHP = /usr/lib/postgresql/8.0/bin/shp2pgsql
Cmnd_Alias PSQL = /usr/lib/postgresql/8.0/bin/psql
Cmnd_Alias LS = /bin/ls
 
# User privilege specification
root	ALL=(ALL) ALL
ROOT_FRIENDS ALL=(ALL)NOPASSWD: SHP
ROOT_FRIENDS ALL=(postgres)NOPASSWD: PSQL
ROOT_FRIENDS ALL=(ALL)NOPASSWD: LS
 
#ROOT_FRIENDS ICI = NOPASSWD: SHP
La commande a executer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
sudo -u postgres /usr/lib/postgresql/8.0/bin/shp2pgsql -s 27593 -I -d /home/kem/import_/Parcelle.shp essai | sudo -u postgres psql -U postgres cartoweb
La 1ere partie de la commande s'excute parfaitement mais la 2e(| sudo -u postgres psql -U postgres cartoweb) ne passe pas et retourne

Sorry, user kem is not allowed to execute '/usr/bin/psql -U postgres cartoweb' as postgres on localhost.localdomain.

Voila mon pb, je souhaite pouvoir executer une commande(plsq) sous un autre profil(postgres) a partir de l'utilisateur kem et non a partir de root.

Quelqu'un a une idee pour mon sudoers ?

Merci par avance