Copy to smb share
Joseph Sinclair
plug-discussion at stcaz.net
Sat May 14 19:05:13 MST 2011
James way works well if you only have to do this once.
If you want to copy files to the smb share regularly (I would assume that given the uri you specify), then installing smbfs (e.g. apt-get install smbfs) and mounting the smb share on a convenient directory (e.g. mount -t smbfs //my-airport-extreme.local/drobo/folder/ /home/shares/drobo/folder/) makes the share part of your file system.
Once you have the share mounted, it's as simple as "cp somefile.ext /home/shares/drobo/folder/".
Once you have it mounted and working, don't forget to add it to /etc/fstab so it's mounted by the system when you're connected to the home network:
*example* line for /etc/fstab, note the uid and gid parameters, which should be your user uid/gid to make access easy.
//my-airport-extreme.local/drobo/folder/ /home/shares/drobo/folder/ smbfs file_mode=0644,dir_mode=0755,uid=####,gid=####,credentials=/etc/my-drobo-user.creds,rw 0 2
The file "/etc/my-drobo-user.creds" is needed if the share requires a username/password and you're not running a Domain Controller or Active Directory service on the network.
This credentials file is owned root:root and file mode 400 for security; it contains the user/password/workgroup for your drobo share in plain text:
username=SOMETHING
password=SOMETHING
workgroup=SOMETHING
I know that's not the safest thing in the world, but I find it works well enough for most home users.
Once that's there, if you find it's not connected, then you can just "sudo mount /home/shares/drobo/folder/" to re-establish the connection.
On 05/14/2011 06:26 PM, James Mcphee wrote:
> Unless you've already connected to the smb share, you won't be able to
> access it. You could try smbclient, and do a put. I'm sure there are other
> ways, but that's the quickest to script. Soooooo wrong from a security
> perspective, but eh.
>
> smbclient //target/share password -W domain -u user <<ENDEND
>> cd path
>> put file
>> ENDEND
>
> Something like that.
>
> On Sat, May 14, 2011 at 5:24 PM, Tom Ostlund <tom at ostlundgroup.com> wrote:
>
> Hello All.
>
> I am trying to figure out how to copy a file to a smb share from the
> command line.
>
> The share is
>
> smb://my-airport-extreme.local/drobo/folder/
>
> my way is failing
>
> cp test.txt smb://my-airport-extreme.local/drobo/folder/test.txt
>
> What is the right way to do this?
>
> Thanks,
> Tom
>
> Mesa AZ
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20110514/1e8cb6d8/attachment.pgp>
More information about the PLUG-discuss
mailing list