Ryan Condron
Ryan Condron

Reputation: 429

Chef Mount must be root to use options

I have the following mount command as part of my recipe. I am needing this to run as root, because I get an error message that only root can use options. Thanks for the help in adavance.

mount mounted_dir do
  action :mount
  fstype 'cifs'
  device '//192.168.0.100/Users/rcondron/Desktop/smart-mobile-images'
  enabled node['smart-mobile']['share']['mount_share']
  options "username=testuser,password=testpwd,domain=domain,file_mode=0777,dir_mode=0777,uid=0"
end

Upvotes: 0

Views: 192

Answers (1)

coderanger
coderanger

Reputation: 54191

You need to run Chef itself as root then.

The mount command is run as whatever user chef-client or chef-solo is running as, if you get an error that says it isn't root then I would suspect something is wrong with how you are running Chef.

Upvotes: 2

Related Questions