Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shell script help?



Hey there:

To quote the quoted:
> > > Im a relitve linux newbi.  Im trying to make a shell script to
> > > automate some network back ups.  Im trying to tar up my system files
> > > then use smbclient to connect to a NT4 server  and upload.  Then
> > > disconect.  I have been able to connect get the script to connect to
> > > the server, but then I cant execute a command.
> > > 
> > > Is it posible to have a shell script enter commands into smbclient? or
> > > any other aplication it may start?

OK, there are two answers here, the simple and specific answer, and the
complex and generic answer.  First, the simple: if you do a 'man
smbclient', you will notice a '-c' option, which allows you to provide a
semicolon-delimited list of commands for smbclient to execute.  For
instance, you could create a shell script to process SMB URLs that would
take in smb://username:password at host/path/to/resource.txt, which might
issue a command of smbclient //host/ password -U username -c 'cd /path/to;
get resource.txt'.

The more generic and complex method is to use expect.  Expect is a
scripting language that can read from programs, write to programs, or
manipulate STDIN/STDOUT in any number of ways.  I've seen people use it to
automate tasks on systems that don't have expect by first logging into a
system that has expect and then having the expect script log on to said
remote machine and do things.  (Caveat: this is given as an example of
what you can do, rather than something that is necessarily intelligent
securitywise.)

> > If you're looking to keep it simple, you can use most ftp clients with a
> > string of commands. 
> > 

Ah, but he wanted SMB access, rather than FTP access.  True, smbclient is
pretty well designed to mimic FTP clients, but it sounded as if FTP was
inadequate to his task.

> Have you mounted the SMB share and tried writing to it?  If the file
> system being shared is NTFS - you probably cannot write to the share
> since, if I remember correctly, writing to NTFS is not yet supported
> (Someone correct me if I am wrong).

Sorry to rain on your parade, but...

You can, indeed, write to any type of filesystem that is offered via the
network share and that you have permission to.  An analogue might be to
think of NFS.  You don't need to know the nuances of Irix's XFS file
system in order to be able to mount the NFS exported XFS drive that your
server offeres you.  The same is true of SMB shared drives.

Where Linux runs into problems is in mounting a local disk that has an
NTFS filesystem on it.  Even then Linux can halfway do it; M$ a while ago
had to issue an advisory, because since Linux could deal with NTFS
partitions, it was now possible to circumvent NT security (previously, NT
was the only OS that could deal with NTFS).

> I know that I have not been able to
> write to some of the drives shared by the NT file servers running NTFS
> from a Linux box at work.

I would guess that you're running into permission problems here.  Remember
that you have multiple levels of permissions to deal with on a share.  Do
you have permission to connect?  Do you have permissions to write to the
directory?  Do you have permisssions to the file you're dealing with?
Remember that NTFS has a lot finer control than Unix filesystems do - you
can set permissions at a group or individual level; so three different
individuals in the same or different groups can have entirely different
permission sets for the same file.

FWIW,
--Mark

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org