This page looks best with JavaScript enabled

Setting raspberry pi with cockpit and file sharing using samba

 ·   ·  β˜• 1 min read

    Update raspberry pi

    sudo apt update
    sudo apt upgrade
    

    Create password for user

    sudo passwd ubuntu

    list all interfaces

    ls /sys/class/net

    add wifi

    Tabs should be maintained otherwise configuration won’t work

    sudo nano /etc/netplan/50-cloud-init.yaml

    network:
        ethernets:
            eth0:
                dhcp4: true
                optional: true
        version: 2
        wifis:
            wlan0:
                dhcp4: true
                optional: true
                access-points:
                    "SSID_name":
                        password: "WiFi_password"
    

    Generate the configuration using this command:

    sudo netplan generate

    And now apply this:

    sudo netplan apply
    sudo systemctl start wpa_supplicant
    

    Install cockpit

    sudo apt install cockpit

    or

    . /etc/os-release
    sudo apt install -t ${VERSION_CODENAME}-backports cockpit
    

    Install samba

    sudo apt install samba cifs-utils
    sudo nano /etc/samba/smb.conf
    

    Add these lines

    [SharedFolder]
      comment = My Shared Folder
      path = /home/ubuntu/shared
      read only = no
      browseable = yes
    

    Restart samba. type:

    /etc/init.d/smbd restart

    Create the share folder:

    sudo mkdir /home/ubuntu/shared

    Set the permissions:

    sudo chmod 0777 /home/ubuntu/shared
    sudo chown ubuntu:ubuntu /home/ubuntu/shared
    

    Congrats!you are all set in ubuntu

    Now that we have our new share configured, save it and restart Samba for it to take effect:

    sudo service smbd restart

    Update the firewall rules to allow Samba traffic:

    sudo ufw allow samba

    Windows configuration

    open regedit

    Browse:

    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters

    set allow insecure guest auth = 1

    Start button -> Run
    Type: \\<your-ip-address-to-ubuntu>\<your-share-folder>

    Now you can see the shared files.


    Ohidur Rahman Bappy
    WRITTEN BY
    Ohidur Rahman Bappy
    πŸ“šLearner 🐍 Developer