Alias disponible avec sudo
Résolu/Fermé
santiago69
Messages postés
477
Date d'inscription
mercredi 7 mars 2001
Statut
Membre
Dernière intervention
12 septembre 2016
-
23 mai 2008 à 09:15
Cham - 28 mars 2014 à 07:48
Cham - 28 mars 2014 à 07:48
8 réponses
Il faut ajouter un alias dans ton ~/.bashrc
Je l'ai testé avec succès sur Ubuntu 10.04.1 et Debian 5.0.5, bash 3.2.39, sudo 1.6.9p17 : ça fonctionne
Vu sur http://ubuntuforums.org/showthread.php?t=217188
alias sudo='A='alias' sudo '
Je l'ai testé avec succès sur Ubuntu 10.04.1 et Debian 5.0.5, bash 3.2.39, sudo 1.6.9p17 : ça fonctionne
Vu sur http://ubuntuforums.org/showthread.php?t=217188
mamiemando
Messages postés
33081
Date d'inscription
jeudi 12 mai 2005
Statut
Modérateur
Dernière intervention
27 avril 2024
7 749
23 mai 2008 à 10:12
23 mai 2008 à 10:12
Je pense qu'il suffit de mettre ces alias dans /root/.bashrc
Bonne chance
Bonne chance
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 895
23 mai 2008 à 10:20
23 mai 2008 à 10:20
Hi,
J'ai donc edite le fichier /root/.bashrc
L'est pas bien réveillée ce matin mamiemando ? ;-))
J'ai donc edite le fichier /root/.bashrc
L'est pas bien réveillée ce matin mamiemando ? ;-))
santiago69
Messages postés
477
Date d'inscription
mercredi 7 mars 2001
Statut
Membre
Dernière intervention
12 septembre 2016
209
23 mai 2008 à 10:22
23 mai 2008 à 10:22
J'ai pourtant clairement ecrit en ligne 10 et 11 de mon post :
Quote:
> J'ai donc edite le fichier /root/.bashrc
> pourtant, les alias ne sont pas reconnus :
Cette technique ne marche donc pas.
Merci quand meme de ton intervention.
Santiago
Quote:
> J'ai donc edite le fichier /root/.bashrc
> pourtant, les alias ne sont pas reconnus :
Cette technique ne marche donc pas.
Merci quand meme de ton intervention.
Santiago
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 895
23 mai 2008 à 10:30
23 mai 2008 à 10:30
Salut,
Essaye :
Essaye :
sudo -i ll /home/Extrait du man sudo :
-i The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of the user that the command is being run as. The command name argument given to the shell begins with a - to tell the shell to run as a login shell. sudo attempts to change to that user's home directory before running the shell. It also ini- tializes the environment, leaving TERM unchanged, setting HOME, SHELL, USER, LOGNAME, and PATH, and unsetting all other environment variables. Note that because the shell to use is determined before the sudoers file is parsed, a runas_default setting in sudoers will specify the user to run the shell as but will not affect which shell is actually run.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
santiago69
Messages postés
477
Date d'inscription
mercredi 7 mars 2001
Statut
Membre
Dernière intervention
12 septembre 2016
209
23 mai 2008 à 10:41
23 mai 2008 à 10:41
$ sudo -i ll /home/ -bash: ll: No such file or directory
Visiblement, il n'imterprete plus ce qui suit ll -i comme une commande.
Bizarre...
Merci quand meme.
mamiemando
Messages postés
33081
Date d'inscription
jeudi 12 mai 2005
Statut
Modérateur
Dernière intervention
27 avril 2024
7 749
23 mai 2008 à 19:54
23 mai 2008 à 19:54
Au pire tu fais un
ou un :
Désolée pour ce matin j'étais effectivement mal réveillée ;-)
Bonne chance
sudo su -
ou un :
sudo -s
Désolée pour ce matin j'étais effectivement mal réveillée ;-)
Bonne chance
santiago69
Messages postés
477
Date d'inscription
mercredi 7 mars 2001
Statut
Membre
Dernière intervention
12 septembre 2016
209
23 mai 2008 à 20:10
23 mai 2008 à 20:10
ben justement c'est ce que j'ai pas envie de faire
en l'occurence, je fais plutot :
puisque mon alias n'est pas reconnu
en l'occurence, je fais plutot :
$ sudo ls -Al
puisque mon alias n'est pas reconnu
lami20j
Messages postés
21331
Date d'inscription
jeudi 4 novembre 2004
Statut
Modérateur, Contributeur sécurité
Dernière intervention
30 octobre 2019
3 567
21 août 2010 à 03:58
21 août 2010 à 03:58
Salut,
Voici un exemple
Voici un exemple
lami20j@debian-acer:~$ echo "alias sudoll='sudo ls -Al'" >>.bashrc lami20j@debian-acer:~$ source .bashrc lami20j@debian-acer:~$ alias| grep ll alias ll='ls -Al' alias sudoll='sudo ls -Al' lami20j@debian-acer:~$ cd boot_grub lami20j@debian-acer:~/boot_grub$ sudoll We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for lami20j: total 12 -rw-rwxr--+ 1 root root 4625 6 sept. 2009 menu.lst lami20j@debian-acer:~/boot_grub$ ls -Al total 12 -rw-rwxr--+ 1 root root 4625 6 sept. 2009 menu.lst lami20j@debian-acer:~/boot_grub$ ll total 12 -rw-rwxr--+ 1 root root 4625 6 sept. 2009 menu.lst
Modifié par Cham le 28/03/2014 à 07:49