CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

[BSD] commande su -c

godrik
godrik
Niveau 30
28 juin 2009 à 00:56:51

Bonjour a vous,
Je fais joujou avec la commande su sous dragonfly BSD et je trouve que le man de su est bizarre.
tout d'abors l'aide interne de su:

  1. su -help

su: illegal option -- h
usage: su [-] [-flm] [-c class] [login [args]]

l'option -c correspond ici a une class et pas a une commande comme sous linux.

On peut en effet lire dans le man :

-c class
Use the settings of the specified login class. Only allowed for
the super-user.

Mais alors les exemple fournit dans cette meme page de manuel sont ENCORE plus etrange:

su -m man -c catman
Runs the command catman as user man. You will be asked for man's
password unless your real UID is 0. Note that the -m option is
required since user ``man does not have a valid shell by
default.
su -m man -c 'catman /usr/share/man /usr/local/man /usr/pkg/xorg/man'
Same as above, but the target command consists of more than a sin-
gle word and hence is quoted for use with the -c option being
passed to the shell. (Most shells expect the argument to -c to be
a single word).
su -m -c staff man -c 'catman /usr/share/man /usr/local/man
/usr/pkg/xorg/man'
Same as above, but the target command is run with the resource
limits of the login class ``staff
. Note: in this example, the
first -c option applies to su while the second is an argument to
the shell being invoked.

Donc, si j'ecoute le manuel et l'option en ligne, l'option -c sert juste pour des problemes de "droits d'acces". Mais si j'en crois les exemples ca sert aussi a executer une commande (comme sous debian). Sachant qu'en pratique ca a l'air de marcher comme sous debian:

  1. su erik -c 'ls /home'

data erik snapshots

Un avis ?

chris_27
chris_27
Niveau 10
28 juin 2009 à 01:28:46
  1. su -c 'ls ~' erik

:-)))

Dargor
Dargor
Niveau 10
29 juin 2009 à 09:30:44

Le -c avant le login = la classe de login, le -c après le login = la commande à exécuter

$ su -c id
su: only the superuser may specify a login class

$ su root -c id
Password:
uid=0(root) gid=0(wheel) groups=0(wheel), 2(kmem), 3(sys), 4(tty), 5(operator), 20(staff), 31(guest)

Sous forums
  • Aide à l'achat Mac
  • Macintosh
  • Création de Jeux
  • Programmation
  • Création de sites web
  • Linux
  • Internet
  • Steam Deck
  • Hardware