samba journey

 To set up /var/www as a Samba share on your Ubuntu machine and allow file transfers, follow these steps:

1. Install Samba (if not already installed)

sudo apt update
sudo apt install samba -y

2. Backup the Samba Configuration

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

3. Edit Samba Configuration

Open the Samba config file in a text editor:

sudo nano /etc/samba/smb.conf

Scroll to the bottom and add this section:

[www]
path = /var/www valid users = youruser browsable = yes writable = yes create mask = 0775 directory mask = 0775 force group = www-data

Replace youruser with your actual Ubuntu username.

4. Set Permissions

Make sure /var/www has the correct permissions:

sudo chown -R youruser:www-data /var/www
sudo chmod -R 0775 /var/www

5. Create a Samba User

Samba users are separate from system users. Add your user to Samba:

sudo smbpasswd -a youruser

You'll be prompted to set a password.

6. Restart Samba

sudo systemctl restart smbd

7. Access the Share

From your local machine, you can now access the share:

  • Linux/macOS:

    smbclient //ubuntu-machine/www -U youruser
  • Windows:
    • Open Explorer and enter \\ubuntu-machine\www
    • Log in with youruser and the Samba password.

Comments

Popular posts from this blog

Tutorials on Unity Probuilder and Progrids

difference between field and property in c#