RH software collections enable para execução de comando com sudo

2

Estamos usando coleções de software RH para python34 e temos o seguinte em /etc/profile.d/scl_enable_python34.sh

source scl_source enable rh-python34

Isso funciona perfeitamente para usuários interativos.

Mas existe uma maneira de ativar a coleção de software python34 para scripts / comandos executados através de sudo ?

    
por batfastad 05.05.2016 / 14:02

1 resposta

0

Eu tive o mesmo problema e usar o sudo -i tornou as ferramentas instaladas do scl utilizáveis com o sudo.

Isso é direto das páginas de trabalho:

"The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. sudo attempts to change to that user's home directory before running the shell. The security policy shall initialize the environment to a minimal set of vari‐ ables, similar to what is present when a user logs in. The Command Environment section in the sudoers(5) manual documents how the -i option affects the environment in which a command is run when the sudoers policy is in use."

    
por 12.01.2018 / 22:37