使用Mac Yosemite 10.10.3
我在我的mac上安装了Jenkins,它与其他应用程序集成,并且有一个重要的文件夹,应该为所有jenkins用户提供访问权限。这可以通过将它们添加到“用户和组”来实现,并为它们提供读取,写入访问权限(右键单击文件夹/获取信息/共享和权限底部/那个'+'符号)。
我的问题简而言之:为了简短起见,jenkins用户应该可以访问该文件夹,并且应该出现在该文件夹的“用户和组”中(如下图所示)。
上述权限是手动提供的,我想使用可以在需要时存储和调用的脚本来实现。
(对于shell脚本和mac来说,新手。)
答案 0 :(得分:2)
If only the jenkins user need to access this folder with a R/W access, you can use the following commands:
sudo chown -R jenkins YOUR_FOLDER (set jenkins as the folder owner)
sudo chmod -R 755 YOUR_FOLDER (jenkins will have a R/W access, read for all the other users)
Update from June 16th 2015
This is a second solution to create a group build_users, add the jenkins user to this group and update the folder permissions.
-- Create the build_users group (with the ID 3333)
sudo dscl . -create /groups/build_users PrimaryGroupID 3333
-- Add the jenkins user in this group
sudo dseditgroup -o edit -a jenkins -t user build_users
-- Make the group build_users owner of the folder
sudo chown -R :build_users my_folder
-- Give R/W permissions to the group build_users
sudo chmod -R g=rw my_folder