Samba setup to share file folder with Windows - pavangayakwad/scripts GitHub Wiki

Install Samba

sudo apt-get install samba

Set samba password

sudo smbpasswd -a $USER

mark a folder samba config file to share on network/LAN

sudo nano /etc/samba/smb.conf

Add this on [global] section

[global]

   server min protocol = SMB3
   server max protocol = SMB3_11
   socket options = TCP_NODELAY SO_RCVBUF=1048576 SO_SNDBUF=1048576
   read raw = yes
   write raw = yes
   min receivefile size = 64K
   use sendfile = yes
   aio read size = 64K
   aio write size = 64K
   getwd cache = yes

Add your folder shares

[<share_name>]
   path = /home/<user_name>/<folder_name>
   available = yes
   valid users = <user_name>
   read only = no
   browseable = yes
   public = yes
   writable = yes

Windows side

Open powershell in admin mode and run this command

Set-SmbClientConfiguration -EnableMultichannel $true

Open regedit.exe in admin mode

go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and created DWORD (32 bit) key with value 0

Restart windows

service restart

[Ubunut] - sudo systemctl restart smbd

[Fedora] - sudo systemctl restart smb

QEMU (LINUX HOST & GUEST) File share

https://ostechnix.com/setup-a-shared-folder-between-kvm-host-and-guest/

Fstab update: (ONLY THIS WORKED FOR ME)

/target_directory_value_from_virt_manager /folder_guest_os 9p trans=virtio,rw,_netdev 0 0

(https://superuser.com/questions/502205/libvirt-9p-kvm-mount-in-fstab-fails-to-mount-at-boot-time) For Ubuntu based machines Added to

/etc/initramfs-tools/modules

9p
9pnet
9pnet_virtio

Then:

sudo update-initramfs -u

Sonic NetExtender doesn't work on linux, Fix it!

  • Put below code in a script, make it runable chmod +x route-fix.sh
  • After connecting to VPN throug NetExtender, run this script.
#!/bin/bash
IP=$(ifconfig ppp0 | grep inet | cut -d: -f2 |awk '{print $2}') #IP assigned post connected to ppp0 VPN
echo $IP  #echos ppp0 IP
route del -net 0.0.0.0 gw $IP dev ppp0 
route add -net 172.16.0.0 gw $IP netmask 255.255.0.0 dev ppp0 #add static route
route add -net 192.168.0.0 gw $IP netmask 255.255.0.0 dev ppp0

Mount a Windows share to a local linux folder

sudo mount.cifs //<dest_machine_ip>/<shared_folder> /home/pavan/Apps/shared_folder -o "username=user,password=xyz"

if mount.cifs refuse to work, install the supporting util sudo apt install cifs-utils

⚠️ **GitHub.com Fallback** ⚠️