Setup Group and User
add user (will add the same group at the same time)
sudo useradd -m jenkins
set password
sudo passwd jenkins
grant `sudo` permission to new user
sudo usermod -aG wheel jenkins
check new user has `wheel` group
vi /etc/group
wheel:x:10:jenkins
switch user
su - jenkins
Setup SAMBA Server
Ensure disable SELinux if you linux is located in Intra-net
Install SAMBA
sudo yum install samba
Enable SAMBA
sudo systemctl start smb nmb
sudo systemctl enable smb nmb
Configure Firewalld to allow access
firewall-cmd –-permanent –-add-service=samba
firewall-cmd –-reload
backup SAMBA conf file first
cp smb.conf smb.conf.bak
Modify SAMBA conf file
sudo vi /etc/samba/smb.conf
[global]
workgroup = JENKINSGROUP
netbios name = team-env
security = user
encrypt passwords = yes
[sharefolder]
browseable = yes
comment = Shared Folder
path = /home/jenkins/sharefolder
read only = No
create mask = 665
force create mode = 665
directory mask = 0775
force directory mode = 0775
valid users = jenkins
restart SAMBA service after modification conf
sudo systemctl restart smb nmb
2770 to the shared folder
sudo chmod 2770 /home/jenkins/sharefolder
before
drwxrwxr-x 2 jenkins jenkins 6 Apr 5 06:59 sharefolder
after
drwxrws--- 2 jenkins jenkins 6 Apr 5 06:59 sharefolder
Add SAMBA user
sudo smbpasswd -a jenkins
Enable SAMBA user
sudo smbpasswd -e jenkins
Setup SAMBA Client
test connection
smbclient //192.168.22.33/sharefolder
to mount
sudo mount -t cifs -o uid=jenkins,gid=jenkins,username=jenkins //192.168.22.33/sharefolder /home/jenkins/sharefolder
to unmout
sudo umount /home/jenkins/sharefolder