Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Use smbpasswd on Raspberry Pi

The smbpasswd command is used to manage user passwords for Samba, a software suite that provides file and print services to SMB/CIFS clients. This is particularly useful for setting up a Raspberry Pi as a file server in a home or small office network. By using smbpasswd, you can add, delete, and modify user passwords for Samba, ensuring secure access to shared resources.

The Raspberry Pi, with its low power consumption and versatility, makes an excellent candidate for a lightweight file server. By configuring Samba and using smbpasswd, you can create a secure and efficient file-sharing environment. This article will guide you through the process of installing Samba, configuring it, and managing user passwords with smbpasswd on a Raspberry Pi.

Examples:

  1. Installing Samba on Raspberry Pi: First, you need to install Samba. Open a terminal on your Raspberry Pi and run the following commands:

    sudo apt update
    sudo apt install samba
  2. Configuring Samba: Once Samba is installed, you need to configure it. Open the Samba configuration file:

    sudo nano /etc/samba/smb.conf

    Add the following lines to the end of the file to create a shared folder:

    [shared]
    path = /home/pi/shared
    available = yes
    valid users = @users
    read only = no
    browsable = yes
    public = yes
    writable = yes

    Save and close the file (Ctrl+O, Enter, Ctrl+X).

  3. Creating a Shared Directory: Create the directory that you specified in the Samba configuration:

    mkdir -p /home/pi/shared
    sudo chown -R pi:users /home/pi/shared
    sudo chmod -R 0775 /home/pi/shared
  4. Adding a Samba User: To add a user to Samba, you need to create a system user first (if not already existing) and then add it to Samba:

    sudo adduser username
    sudo smbpasswd -a username

    You will be prompted to enter and confirm a password for the user.

  5. Restarting Samba Service: After making changes to the configuration, restart the Samba service to apply the changes:

    sudo systemctl restart smbd
  6. Testing the Configuration: You can test the Samba configuration by accessing the shared folder from another device on the same network. Use the following command from a Windows machine:

    \\<Raspberry_Pi_IP_Address>\shared

    You will be prompted to enter the username and password you set up earlier.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.