2014-02-06 1 views
0

두 가지 시나리오. 내가 사용 노드에서 MYSQL을 설치하고 요리사 클라이언트 :"sudo"command vs "su"에서 chef-client 실행 문제

1) 첫 번째 시나리오에서 나는 "sudo를"로 실행 :

sudo chef-client 

[2/5/14 6:30:31 PM] xxxx : : xxx: * execute[ldconfig] action run 
================================================================================ 
Error executing action `run` on resource 'execute[ldconfig]' 
================================================================================ 
[2/5/14 6:30:41 PM] xxxx : : xxx: when I run again "chef-client" then it works 
[2/5/14 6:30:48 PM] xxxx : : xxx: I was running as: sudo chef-client 
[2/5/14 6:31:15 PM] xxxx : : xxx: Errno::ENOENT 
------------- 
No such file or directory - ldconfig 

2) 두 번째 시나리오에서에서 위의 VM을 다시 동일한 시작점이면 오류없이 성공합니다 :

sudo su - 
chef-client 

나중에 시나리오가 성공하며 ldconfig와 관련된 오류가 없습니다.

따라서 저는 셰프 - 클라이언트의 sudo 명령이 작동하지 않는 이유에 대해 혼란 스럽습니다. 두 번째 문제는 없습니다.

+0

모든 것이 환경에 관한 것입니다. 그것들은 근본적으로 다른 것들입니다. – sethvargo

답변

2

셸의 환경에있을 수 있습니다. 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. The 
     invoked shell is the target login's, and su will change directory to the target login's home directory. 

-  (no letter) The same as -l. 

가 실행 su - 사용자 환경의 내용을 던져 sudo를하지 않습니다. 오히려 그것은 ldconfig 명령이 무엇을하려고했는지에 관해 무엇인가를 던지고있는 무언가를 지키고 있습니다.