LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Maping samba shared directory automaticaly (https://www.linuxquestions.org/questions/linux-enterprise-47/maping-samba-shared-directory-automaticaly-466128/)

RajendraKumar 07-21-2006 01:13 AM

Maping samba shared directory automaticaly
 
Hello All,
I have configured samba server on RHEL 3 and it is working fine.
Now I want to share a directory that will be automaticaly mounted when login on to a windows XP/2000 machine.

My configuration part of smb.config is as below

[ITM DATA]
comment = File Server - ITM
path = /ITM DATA
writeable = yes
guest ok = yes

[cdrom]
path = /mnt/cdrom
guest ok = yes


[itmbhl]
comment = Database
path = /itmbhl
valid users = raj
writeable = yes
create mask = 0765
printable = no
public = no

Please help me.
Have a nice day,

Rajendra

abakali 07-21-2006 01:22 AM

Samba Domain Control
 
[global]

;basic server settings
workgroup = home-domain
server string = ClarkConnect
socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192
wins support = yes

;PDC and master browser settings
os level = 64
preferred master = yes
local master = yes
domain master = yes
domain logons = yes

;security and logging settings
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
log file = /var/log/samba/log.%m
log level = 2
max log size = 50
hosts allow = 127.0.0.1 192.168.1.0/255.255.255.0
interfaces = eth1 192.168.1.0/255.255.255.0 127.0.0.1

;user profiles and home directory
logon path = \\%L\profiles\%U
logon script = netlogon.bat your mount drives scripts

# ==== shares ====

[homes]
comment = Home Directories
browseable = no
writeable = yes

[profiles]
path = /home/samba/profiles
profile acls = yes
writable = yes
browseable = no
guest ok = yes

[netlogon]
comment = Network Logon Service
path = /home/netlogon
guest ok = yes
writable = no
share modes = no

[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

--------------------------------------------------------------------------------


Ok, just change the server-string to be the name that you want your ClarkConnect box to have, and the workgroup to be the name of your domain. Save it as /etc/samba/smb.conf

Next we need to do some housekeeping and create some groups, directories and machine trust accounts. Again, as root do the following:

Code:
--------------------------------------------------------------------------------

groupadd -g 200 admins
groupadd -g 201 machines

mkdir -m 0775 /home/netlogon
chown root.admins /home/netlogon
mkdir /home/samba /home/samba/profiles
chmod 1757 /home/samba/profiles

--------------------------------------------------------------------------------


These steps create the necessary directories. The permissions and owners are quite important, as giving the wrong people access to, say for instance, the netlogon directory then they could make every windows machine that logs on to the domain run any particular program/command... ie it is quite a big backdoor which you want firmly locked.

Ok, now check to see if everything is fine, and restart samba with the following commands:

Code:
--------------------------------------------------------------------------------

testparm -x |more
/etc/init.d/smb restart

--------------------------------------------------------------------------------


this will (after hitting enter) check smb.conf to make sure there is nothing seriously wrong with it, and it will spit out the specifics of what you have configured. The second command stops and restarts samba. If you don’t have samba running then you can just use start instead of restart. To make samba start up on boot you can use the web based configuration of CC.

Machine trust accounts are what the windows machines log in to the domain with. There is/was a way of doing this automagically the first time a machine connects, but i haven’t worked out how to do it in Samba 3 yet. There doesn’t seem much point as I’m only connecting 3 computers to my domain. Here is how you creat a machine account for a computer with the network id of “flower”

Code:
--------------------------------------------------------------------------------

useradd -g machines -d /dev/null -c “Trust Account” -s /bin/false flower$
passwd -l flower$
smbpasswd -a -m flower

--------------------------------------------------------------------------------


Yes, the ‘$’ sign is important. Don’t leave it out of the first two commands or it won’t work. The second command there creates a locked password for the machine. The third command sets the samba password for the machine, this time don’t include the ‘$’ sign.

Next you need to create the login for the profile you want to use on your new domain. In this case the login name is fred.

Code:
--------------------------------------------------------------------------------

useradd fred
passwd fred

--------------------------------------------------------------------------------


Now type in the new password for fred as prompted (twice) (this one isn’t the one you’ll log in with from your windows machine, but you might as well make it the same)

Code:
--------------------------------------------------------------------------------

smbpasswd -a fred

--------------------------------------------------------------------------------


This password is the windows domain password for the user fred in the domain HOME-DOMAIN

In order to allow machines to join the domain you need to create a samba password for the root account. You do this by typing in the command below then typing in a password.

Code:
--------------------------------------------------------------------------------

smbpasswd -a root

RajendraKumar 07-21-2006 03:54 AM

Quote:

Originally Posted by abakali
[global]

;basic server settings
workgroup = home-domain
server string = ClarkConnect
socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192
wins support = yes

;PDC and master browser settings
os level = 64
preferred master = yes
local master = yes
domain master = yes
domain logons = yes

;security and logging settings
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
log file = /var/log/samba/log.%m
log level = 2
max log size = 50
hosts allow = 127.0.0.1 192.168.1.0/255.255.255.0
interfaces = eth1 192.168.1.0/255.255.255.0 127.0.0.1

;user profiles and home directory
logon path = \\%L\profiles\%U
logon script = netlogon.bat your mount drives scripts

# ==== shares ====

[homes]
comment = Home Directories
browseable = no
writeable = yes

[profiles]
path = /home/samba/profiles
profile acls = yes
writable = yes
browseable = no
guest ok = yes

[netlogon]
comment = Network Logon Service
path = /home/netlogon
guest ok = yes
writable = no
share modes = no

[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes

--------------------------------------------------------------------------------


Ok, just change the server-string to be the name that you want your ClarkConnect box to have, and the workgroup to be the name of your domain. Save it as /etc/samba/smb.conf

Next we need to do some housekeeping and create some groups, directories and machine trust accounts. Again, as root do the following:

Code:
--------------------------------------------------------------------------------

groupadd -g 200 admins
groupadd -g 201 machines

mkdir -m 0775 /home/netlogon
chown root.admins /home/netlogon
mkdir /home/samba /home/samba/profiles
chmod 1757 /home/samba/profiles

--------------------------------------------------------------------------------


These steps create the necessary directories. The permissions and owners are quite important, as giving the wrong people access to, say for instance, the netlogon directory then they could make every windows machine that logs on to the domain run any particular program/command... ie it is quite a big backdoor which you want firmly locked.

Ok, now check to see if everything is fine, and restart samba with the following commands:

Code:
--------------------------------------------------------------------------------

testparm -x |more
/etc/init.d/smb restart

--------------------------------------------------------------------------------


this will (after hitting enter) check smb.conf to make sure there is nothing seriously wrong with it, and it will spit out the specifics of what you have configured. The second command stops and restarts samba. If you don’t have samba running then you can just use start instead of restart. To make samba start up on boot you can use the web based configuration of CC.

Machine trust accounts are what the windows machines log in to the domain with. There is/was a way of doing this automagically the first time a machine connects, but i haven’t worked out how to do it in Samba 3 yet. There doesn’t seem much point as I’m only connecting 3 computers to my domain. Here is how you creat a machine account for a computer with the network id of “flower”

Code:
--------------------------------------------------------------------------------

useradd -g machines -d /dev/null -c “Trust Account” -s /bin/false flower$
passwd -l flower$
smbpasswd -a -m flower

--------------------------------------------------------------------------------


Yes, the ‘$’ sign is important. Don’t leave it out of the first two commands or it won’t work. The second command there creates a locked password for the machine. The third command sets the samba password for the machine, this time don’t include the ‘$’ sign.

Next you need to create the login for the profile you want to use on your new domain. In this case the login name is fred.

Code:
--------------------------------------------------------------------------------

useradd fred
passwd fred

--------------------------------------------------------------------------------


Now type in the new password for fred as prompted (twice) (this one isn’t the one you’ll log in with from your windows machine, but you might as well make it the same)

Code:
--------------------------------------------------------------------------------

smbpasswd -a fred

--------------------------------------------------------------------------------


This password is the windows domain password for the user fred in the domain HOME-DOMAIN

In order to allow machines to join the domain you need to create a samba password for the root account. You do this by typing in the command below then typing in a password.

Code:
--------------------------------------------------------------------------------

smbpasswd -a root

WoW Its working fine ,Thanks My dear,Thanks A lot
Have a nice day,

Rajendra

RajendraKumar 07-21-2006 05:57 AM

Quote:

Originally Posted by RajendraKumar
WoW Its working fine ,Thanks My dear,Thanks A lot
Have a nice day,

Rajendra

Hello Now I want to share a directory which will open directly without any username and password through any windows machine

like
typing in start->run itmserver

then that shared directory will flash

please help me

thanks

Rajendra


All times are GMT -5. The time now is 11:50 PM.