We will copy apt cache archive and create a folder
that can accessed over network using samba.
create directory inside /home/sangram my username
mkdir -p /home/sangram/cache/apt/archives
Copy all deb files from archive
sudo mv /var/cache/apt/archives/*.deb /home/sangram/cache/apt/archives
Create a user sadmin for purpose of software installtion
Create a New User
sudo adduser --no-create-home sadmin
sudo adduser sadmin
I kept password say "sangram" for user sadmin
You can delete sadmin user by following command
sudo deluser --remove-home sadmin
groupdel sadmin
you can switch user to samin as follows
su sadmin
Add the User to the sudo Group
sudo usermod -aG sudo sadmin
List groups to which sadmin belongs
groups sadmin
Then add sadmin to samba group & set samba password
sudo smbpasswd -a sadmin
Add user sadmin to groups
sudo usermod -aG sambashare sadmin
Change Ownership of /home/sangram/cache/apt/archives folder to sadmin
sudo chown -R sangram:sambashare /home/sangram/cache/
sudo chmod 775 /home/sangram/cache/apt/archives
List users added to samba group
sudo pdbedit -L
Edit smb.conf to make folder /home/sangram/cache/apt/archives
available over network.
sudo nano /etc/samba/smb.conf
Add following to end of file
[SharedAptCacheArchives]
path = /home/sangram/cache/apt/archives
browsable = yes
writable = yes
guest ok = no
read only = no
create mask = 0755
directory mask = 0755
force create mode = 0755
Add following to global section
usershare owner only = false
how to test smb.conf configuration is correct
testparm
Restart samba service:
sudo systemctl restart smbd nmbd
If My Machine Ip Address is 192.168.0.122 then smb://192.168.0.122/SharedAptCacheArchives
will be network url
Mount Shared SharedAptCacheArchives folder
cd /mnt
sudo mkdir SharedAptCacheArchives
sudo chmod 750 /home/sangram
sudo chown sangram:sambashare /home/sangram
sudo chmod -R 755 /mnt/SharedAptCacheArchives
sudo chown -R sangram:sambashare /mnt/SharedAptCacheArchives
sudo mount -t cifs //192.168.0.122/SharedAptCacheArchives /mnt/SharedAptCacheArchives -o sec=ntlmv2,username=sadmin,password=sangram,vers=3.0,uid=$(id -u sadmin),gid=$(id -g sadmin)
If mounted successfully then /mnt/SharedAptCacheArchives will acts as if
this folder contain all debian files in it from /home/sangram/cache/apt/archives
Enable Required Services (troubleshooting):
sudo systemctl enable systemd-networkd-wait-online
sudo systemctl enable networkd-dispatcher.service
sudo systemctl enable systemd-networkd.service
sudo systemctl enable NetworkManager-wait-online.service
systemctl status networkd-dispatcher.service systemd-networkd.service
View Logs of error in mounting at
sudo dmesg | tail -n 20
You can also view mounted filesystems by checking the /proc/mounts file
cat /proc/mounts
Check Folder Permission
cd /home/sangram/cache/apt/archives/
ls *.deb -ld .
To test our setting we will use smbclient as follows
List all shared folderson the ip address (Machine)
smbclient -L //192.168.0.122 -U sadmin
You can check if our setup worked or not by using smbclient.
After login run "ls"command to verify files are there.
smbclient //192.168.0.122/SharedAptCacheArchives -U sadmin
smbclient //192.168.0.122/SharedAptCacheArchives -U sangram
Logs of error while mounting can be viewed by following query:
sudo dmesg | tail -n 20
No comments:
Post a Comment