To mount a Samba share folder using the command line, you’ll need to use the mount command with the cifs filesystem type and specify the server and share paths, along with your credentials if required. 

Here’s a breakdown of the process: 

  1. 1. Install necessary packages:
    • On Debian/Ubuntu: sudo apt-get install cifs-utils
    • On Fedora/CentOS/RHEL: sudo dnf install cifs-utils
  2. 2. Create a mount point:
    • Choose or create a directory where you want to mount the share (e.g., /mnt/myshare):
Code
     sudo mkdir /mnt/myshare     ``` [2, 5]3. **Mount the share:**   - Use the following command, replacing placeholders with your actual values:     ```bash     sudo mount -t cifs //[server_ip]/[share_name] /mnt/myshare -o username=[your_username],password=[your_password],domain=[your_domain]     ``` [2, 5]     - `[server_ip]`: The IP address or hostname of the Samba server.     - `[share_name]`: The name of the shared folder on the server.     - `/mnt/myshare`: The mount point you created.     - `[your_username]`: Your username for accessing the share.     - `[your_password]`: Your password for accessing the share.     - `[your_domain]`: The domain (if applicable) for your username [5].     -  **Note**: For a guest mount, use `guest` instead of username and password.4. **Verify the mount:**   - Use the `df -h` command to check if the share is mounted:     ```bash     df -h     ``` [7]     -  Look for an entry similar to: `//[server_ip]/[share_name]  ... /mnt/myshare` [7]5. **Optional: Unmount the share:**   - To unmount the share when you're done, use:     ```bash     sudo umount /mnt/myshare     ``` [7]6. **Optional: Automount on boot (fstab):**   - To make the mount permanent, edit the `/etc/fstab` file (use `sudo nano /etc/fstab` or a similar editor):     - Add a line like this, adjusting for your settings:
//[server_ip]/[share_name] /mnt/myshare cifs username=[your_username],password=[your_password],domain=[your_domain] 0 0 

Code
     - Be cautious when editing `/etc/fstab`, incorrect entries can prevent your system from booting.     -  Consider using a credentials file instead of storing the password directly in `/etc/fstab`.**Example:**If your server IP is `192.168.1.100`, the share name is `public`, your username is `user1`, and the password is `pAssWord`, the mount command would be:```bashsudo mount -t cifs //192.168.1.100/public /mnt/myshare -o username=user1,password=pAssWord,domain=workgroup
This assumes your domain is workgroupYou can also use a credentials file for better security.

By faiz

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *