Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mount Samba Share from the Terminal [SOLVED]
#1
So on one of my Raspberry Pis is a samba server.  I've got some files to upload to it and was curious to see if it was possible to mount it in the file system in the terminal so that I could have a script to execute that would do if for me instead of going into nautilus and using the "Connect to Server" option to connect to Samba all the time.


I'm running Ubuntu 16.04.
Just a teen who LOVES working with computers
Reply
#2
(06-11-2019, 11:00 PM)Jeremiah Wrote: [...] if it was possible to mount it in the file system in the terminal so that I could have a script to execute that would do if for me [...]

This site explains accessing and mounting samba shares via the terminal
(Mounting is explained at the bottom)
My website - My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply
#3
Tried that. It didn't work. Here is the output:

Code:
~$ smbmount "\\\\192.168.0.29\\share" -U rtg2t -c 'mount /share -u 500 -g 100'
smbmount: command not found
~$ sudo apt install smbmount
[sudo] password for haven:
Reading package lists... Done
Building dependency tree      
Reading state information... Done
E: Unable to locate package smbmount
~$
Just a teen who LOVES working with computers
Reply
#4
The command 'smbmount' has been deprecated for ages and is no longer installed in most of the current Linux distributions.

You are supposed to use 'mount.cifs' or 'mount -t cifs' instead. For the differences concerning parameters you have to consult the man pages.

The program 'mount.cifs' is part of a package called 'cifs-utils' in most distributions.

HTH
Reply
#5
(06-13-2019, 11:03 AM)radolkin Wrote: You are supposed to use 'mount.cifs' or 'mount -t cifs' instead. For the differences concerning parameters you have to consult the man pages.

The program 'mount.cifs' is part of a package called 'cifs-utils' in most distributions.

HTH

I installed the package and skimmed through the man page. Here is my syntex:

Code:
~$ sudo mount -t cifs "\\\\192.168.0.29\\share" username="pi" password="[I do not want to show my password]"


What I get is a help page from mount:

Code:
Usage:
mount [-lhV]
mount -a [options]
mount [options] [--source] <source> | [--target] <directory>
mount [options] <source> <directory>
mount <operation> <mountpoint> [<target>]

Mount a filesystem.

Options:
-a, --all               mount all filesystems mentioned in fstab
-c, --no-canonicalize   don't canonicalize paths
-f, --fake              dry run; skip the mount(2) syscall
-F, --fork              fork off for each device (use with -a)
-T, --fstab <path>      alternative file to /etc/fstab
-i, --internal-only     don't call the mount.<type> helpers
-l, --show-labels       show also filesystem labels
-n, --no-mtab           don't write to /etc/mtab
-o, --options <list>    comma-separated list of mount options
-O, --test-opts <list>  limit the set of filesystems (use with -a)
-r, --read-only         mount the filesystem read-only (same as -o ro)
-t, --types <list>      limit the set of filesystem types
    --source <src>      explicitly specifies source (path, label, uuid)
    --target <target>   explicitly specifies mountpoint
-v, --verbose           say what is being done
-w, --rw, --read-write  mount the filesystem read-write (default)

-h, --help     display this help and exit
-V, --version  output version information and exit

Source:
-L, --label <label>     synonym for LABEL=<label>
-U, --uuid <uuid>       synonym for UUID=<uuid>
LABEL=<label>           specifies device by filesystem label
UUID=<uuid>             specifies device by filesystem UUID
PARTLABEL=<label>       specifies device by partition label
PARTUUID=<uuid>         specifies device by partition UUID
<device>                specifies device by path
<directory>             mountpoint for bind mounts (see --bind/rbind)
<file>                  regular file for loopdev setup

Operations:
-B, --bind              mount a subtree somewhere else (same as -o bind)
-M, --move              move a subtree to some other place
-R, --rbind             mount a subtree and all submounts somewhere else
--make-shared           mark a subtree as shared
--make-slave            mark a subtree as slave
--make-private          mark a subtree as private
--make-unbindable       mark a subtree as unbindable
--make-rshared          recursively mark a whole subtree as shared
--make-rslave           recursively mark a whole subtree as slave
--make-rprivate         recursively mark a whole subtree as private
--make-runbindable      recursively mark a whole subtree as unbindable

For more details see mount(8).

I guess that mount isn't getting that I am trying to use cifs. I do not know what to do. Or is it something else?

EDIT:
Instead of using mount -t cifs, I used mount.cifs. Then with the output of that command I rewrote the syntex of the command to:

Code:
$ sudo mount.cifs "\\\\192.168.0.29\\share" Samba/ username="pi" password="[I do not want to show my password!]"
Password for root@\192.168.0.29\share:
$

and it is mounted! Thank you!
Just a teen who LOVES working with computers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)