> From: Rob Beard <r...@esdelle.co.uk>
> Subject: Re: [ubuntu-uk] commands to navigate a windows network for a
>        script
> To: British Ubuntu Talk <ubuntu-uk@lists.ubuntu.com>
> Message-ID: <49e4b131.1020...@esdelle.co.uk>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> doug livesey wrote:
>> Hi -- I have set up a database server at work that I currently run
>> backups on myself, but wish to put this into a cron job.
>> One of the things I would like to do is to have that backup take
>> place, then to have it copied over to our work's windows network,
>> where it can be caught in our nightly backup to tape.
>> Could anyone offer me some pointers as to how I should write this
>> script, particularly with reference to how I get on to & navigate the
>> windows network?
>> Thanks,
>>    Doug.
> Presumably you'd want your backup script to copy the data to the Windows
> machine with the tape drive on it?
>
> What you'll need to do is mount a share on the Window server.  If you
> install the smbfs package you'll be able to use either smbmount or mount
> with the type cifs or smbfs (although IIRC smbfs is being replaced by cifs).
>
> I normally do this when backing up machines using Partimage on the
> System Rescue CD.
>
> I'd enter a command such as...
>
> sudo mount -t cifs -o username=myusername,password=mypassword
> //server/share /mnt/mountpoint
>
> Where myusername is the username of the user who is connecting to the
> share, mypassword is the users password, you can also store the password
> in a password file.  If it was me I'd create a basic user with limited
> access to just the one share and nothing else, that way if the password
> was compromised then it should in theory limit the access that that
> particular user can access.  I believe you can also specify a domain too
> using domain=mydomain.
>
> //server/share is the address of the server and the share name, this can
> also be an ip address for instance //192.168.0.1/myshare
>
> Note the slashes are forward slashes rather than backslashes but still
> are double slashes (//).
>
> Finally /mnt/mountpoint points to a mount point on the Linux box running
> the script.
>
> To unmount the share just use sudo umount /mnt/mountpoint
>
> If you're always going to use the same share you could also put the
> details in fstab which should then resolve the need to mount the share
> as root (using sudo).
>
> You can find plenty of information too in the smbmount man page (man
> smbmount) after you have installed the smbfs package.
>
> Basically once the share is mounted on the Linux filesystem then it
> should work pretty much like any other file or directory although
> anything you store in there will be owned by the user you used to mount
> the share.
>
> Hope this helps.
>
> Rob
__________________________________________________________

I have a Linux box at work (shsssss, don't tell anyone!!) and had to
navigate the Windows domain to get to the normal shares...
I used FSTab file in /etc to map these drives for me automatically. Steps I did:
1. Create a Map dir on linux like /home/MyWinShare1
2. Create a "Password"/Credentials file that is only allowed to be
read by root lets say in /etc with content
username=MyDomainUserName       password=MyWinPass
3. Add entry in FSTab file:
//ServerName/ShareDir           /home/MyWinShare1       smbfs   
credentials=/etc/MyPasswords,workgroup=MyWinDomain,rw   0       0
4. run sudo mount -a to immediately remount mount the fstab entries,
thisway you will also not any mistakes you made, if all goes ok you
will have a mounted WinSahre else fix the errors and try again.

The reason for the Password file is to make it more secure (not allow
others to change or read the file, Just remember to change your
password once your Domain Password changes (ours change once every
month)

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/

Reply via email to