Компания Microsoft представила собственную реализацию утилиты sudo, предназначенную для организации выборочного выполнения команд в терминале с правами администратора. Утилита включена в тестовые сборки Windows 11 Insider Preview Build 26052 (активируется в секции настроек "Developer Features"), войдёт в состав следующего обновления Windows 11 и в будущем возможно будет портирована для Windows 10. Код утилиты планируют открыть под лицензией MIT (в настоящий момент доступен только каркас репозитория и обвязка на PowerShell).

Утилита написана с нуля с оглядкой на интеграцию с Windows и лишь концептуально реализует идеи классического проекта sudo, используемого в Linux, отличаясь от него на уровне опций командной строки и логики делегирования полномочий. Утилита также пока отстаёт по функциональности от существующего независимого проекта gsudo, развивающего аналог sudo для Windows, распространяемый под лицензией MIT.

Из особенностей sudo от Microsoft отмечается вывод диалога подтверждения операции, запуск приложений в новом окне (forceNewWindow), по месту (normal) или в режиме с блокированием ввода данных (disableInput). В отличие от уже имеющейся утилиты runas, sudo от Microsoft поддерживает только выполнение программ с предоставлением полномочий администратора и не может применяться для запуска под другими пользователями. Кроме того sudo не запрашивает пароль администратора, а применяет механизм UAC (User Account Control) для верификации запроса.

// cc-by opennet.ru
// converted with crypt’s opennet autoreposter <<<

  • cryptOP
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    ты на генту что ли пересидел. всю жизнь su и su минус работали.

         -l      Simulate a full login.  The environment is discarded except for
                 HOME, SHELL, PATH, TERM, and USER.  HOME and SHELL are modified
                 as above.  USER is set to the target login.  PATH is set to
                 “/bin:/usr/bin”.  TERM is imported from your current environment.
                 Environment variables may be set or overridden from the login
                 class capabilities database according to the class of the target
                 login.  The invoked shell is the target login's, and su will
                 change directory to the target login's home directory.  Resource
                 limits and session priority are modified to that for the target
                 account's login class.
    
         -       (no letter) The same as -l.
    
    

    это из FreeBSD, а в ней такие вещи по 20 лет не меняются.

    • TheAnonymous
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      В дебиане https://sources.debian.org/src/util-linux/2.33.1-0.1/debian/util-linux.NEWS/ The util-linux implementation of /bin/su is now used, replacing the one previously supplied by src:shadow (shipped in login package), and bringing Debian in line with other modern distributions. The two implementations are very similar but have some minor differences (and there might be more that was not yet noticed ofcourse), e.g.

      • new ‘su’ (with no args, i.e. when preserving the environment) also preserves PATH and IFS, while old su would always reset PATH and IFS even in ‘preserve environment’ mode.
      • new ‘su -’ (creating new environment) will do just that, while old su would always preserve content of DISPLAY and XAUTHORITY environment variables. Set them as needed (but beware X doesn’t give you any real privileges separation anyway if you can access an X server of another user). See pam_xauth(8) if you want to reconfigure pam for seamless xauth keys.
      • su ‘’ (empty user string) used to give root, but now returns an error.
      • previously su only had one pam config, but now ‘su -’ is configured separately in /etc/pam.d/su-l. This file additionally invokes ‘pam_keyinit’ to revoke the session keyring.

      The first difference is probably the most user visible one. Doing plain ‘su’ is a really bad idea for many reasons, so using ‘su -’ is strongly recommended to always get a newly set up environment similar to a normal login. If you want to restore behaviour more similar to the previous one you can add ‘ALWAYS_SET_PATH yes’ in /etc/login.defs. В debian 9 su из shadow, в 10 - из util-linux

      • cryptOP
        link
        fedilink
        arrow-up
        0
        ·
        2 years ago

        вот поэтому я линукс и возненавидел. вечно кровати двигают. вечно ломают старое поведение.

        man rhel6 такой:

        DESCRIPTION
               Change the effective user id and group id to that of USER.
        
               -, -l, --login
                      make the shell a login shell, clears all envvars except for TERM, initializes HOME, SHELL, USER, LOGNAME and PATH
        
        
      • cryptOP
        link
        fedilink
        arrow-up
        0
        ·
        2 years ago

        причем оцени, во фряхе su интегрирован с логин группами

        determines session accounting,
             resource limits and user environment settings.  It is used by various
             programs in the system to set up a user's login environment and to
             enforce policy, accounting and administrative restrictions.  It also
             provides the means by which users are able to be authenticated to the
             system and the types of authentication available.
        

        а в линуксе, я уже забыл, какая по счету надстройка для этого.