Is it possible to access samba server from command line?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Distribution: Debian Etch i386, Lenny and Sid amd64
Posts: 176
Rep:
Is it possible to access samba server from command line?
Hi all, the subject already asks the question. The reason I ask is that I would like to be able to set something up (like cron, or just a "clickable" script) to backup/synchronize certain directories on my computer with a server. I can do it through KDE with drag and drop, but that is not a very good solution for me. Something along the lines of "SyncBack" (http://www.2brightsparks.com/syncbac...back-hub.html). If I could write a script that would be able to copy files back and forth via samba, that would work too. such as: "cp -a /home/rodney/documents smb://debian/Disk-2/documents". Obviously, that does not work! But that's generally the idea of what I want to accomplish.
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,697
Rep:
For a script use the mount command to mount the share, copy files to the share mount location, and then umount the share. I think this is what you are after.
I am writing my own backup script that sounds similar to what you're attempting to do. Below is what I've gotten written so far. It is a "proof of concept" framework only. I HAVE NOT TRIED EXECUTING IT YET! But you can get the general idea of where I'm heading by looking at the (possibly incorrect - no, PROBABLY incorrect!) code below. I just threw in likely looking candidate parameters into my proof-of-concept so I will remember to investigate them further. I may have specificed some incompatible options. Run "man rsync" to see all the neat things you can do with this command.
You might be able to beef it up and use something similar. I will be using my script locally, but since you want to go over a network you'd need to add something like this to the rsync command: "--rsh=ssh". And also modify the lines mentioning "destination" below to some other form consistant with a remote server as the destination.
Distribution: Debian Etch i386, Lenny and Sid amd64
Posts: 176
Original Poster
Rep:
Thank you very much! I've been toying around with it so far, and it seems to work fine (with a few quirks, but most of those are cause by me!). Don't have much time at this point to put together a script with every little thing I want to do, but I think if I save yours for reference that will help too.
I will likely be back at another date to ask some more questions, so I'll save this thread and come back to it later.
Brian, I'm not sure what you mean; can you actually mount a samba share locally (from another computer)?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.