LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 07-20-2009, 03:07 PM   #1
Plato
LQ Newbie
 
Registered: Jun 2009
Location: Huntsville, Alabama
Distribution: RHEL 5.3
Posts: 12

Rep: Reputation: 0
Samba share script advice


This is my first time posting, and just ran into a little problem with samba. Im trying to make a script that will create a / directory, and make that directory a samba share. What I am wondering is if a samba share can even be created in a script. I understand that the /etc/samba/smb.conf has to be editted to create a share, or can be done in Samba gui. Any input is much appreciated. Thank you in advance.
 
Old 07-21-2009, 04:46 PM   #2
mjlouis
Member
 
Registered: Nov 2008
Posts: 48

Rep: Reputation: 16
If you want it scripted, then GUI is not really an option. You may want to experiment with >> as this will append data to a file.
If you have file1 and file2 then the following will stick the contents of file1 at the end of file2:
Code:
 cat file1 >> file2
file1 could contain your share entry and file2 is your smb.conf - of course, you're going to try this with some harmless file1 and file2 to test it out *before* running wild with your smb.comf aren't you? :-)
 
Old 07-22-2009, 01:23 PM   #3
Plato
LQ Newbie
 
Registered: Jun 2009
Location: Huntsville, Alabama
Distribution: RHEL 5.3
Posts: 12

Original Poster
Rep: Reputation: 0
Solved

Ive got it working now. Thanks for the spark mjlouis. This is the code I'm using below that adds to the configuration file. Earlier in the script i prompt for a username, hence the $NAME's.

Code:
echo [$NAME] >> /etc/samba/smb.conf 
echo path = /folder >/etc/samba/smb.conf
echo valid users = $NAME >> /etc/samba/smb.conf
echo     >> /etc/samba/smb.conf

Last edited by Plato; 07-22-2009 at 01:25 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount windows share export to samba share -> improve network performance tuning newuser77 Linux - Server 1 07-23-2008 11:28 AM
[SOLVED] Bash Script to copy files to SAMBA Share bskrakes Linux - Newbie 4 07-03-2008 07:51 AM
samba share login script trouble barje Linux - Server 3 03-11-2008 05:38 PM
shell script to mount samba share with " " in the remote path dohpaz Programming 2 10-20-2006 02:18 PM
mapping a SAMBA share with a login script Drizzt420 Linux - Software 2 07-19-2003 02:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration