Showing posts with label Linux-Windows. Show all posts
Showing posts with label Linux-Windows. Show all posts

login to a windows domain from linux

0 comments

for an NT domain, you should have the following in your smb.conf:
netbios name = SAMBA
workgroup = EVALUESERVE
security = domain
password server = IP_address_of_your_DC

you should then be able to do something like:
smbpasswd -j EVALUESERVE -r IP_address_of_your_DC -U NT_ADMINISTRATOR

Windows Active directory
First, make sure kerberos is installed:
# rpm -qa grep krb
this should return at least 3 packages: krb5-devel, krb5-libs and krb5-workstation Next, make sure the ldap development libraries are installed:
# rpm -qa grep ldap-devel
If either of these returns nothing, you'll need to install them - which you can do from the Redhat CD.
make sure there's an entry for your active directory DC in your /etc/hosts file: 1.2.3.4 addc.example.com addc
Next, edit your /etc/krb5.conf to match your site. Everything should be fairly self-explanitory - and everything is case sensitive. Do not comment this file.
Once you've gotten to this point, you can try:
# /usr/kerberos/bin/kinit user@DOMAIN.COM
replacing *user* with a real user and DOMAIN.COM with a real domain (which must be UPPERCASE). If things are working, you'll be prompted for a password. If you enter the correct password, you'll come back to a bash shell, if not, you should be presented with:
"kinit(v5): Preauthentication failed while getting initial credentials"
or some such.
Note: If the clock time on the Linux machine is more than 5 minutes off from the time on the windows machine no ticket information will work. There are three wys to deal with this:
1. Have the Linux server act as a network time server, with the windows machine as a client
2. Have the windows machine act as a time server for the linux client
3. Make both systems pull the time from the same 3rd server ( some are listed here - http://ntp.isc.org/bin/view/Servers/NTPPoolServers )

Next, uninstall samba if it's installed:
# rpm -e samba
get the latest version of samba:
$ wget http://us1.samba.org/samba/ftp/samba-latest.tar.gz
expand and install samba:
$ tar -zxvf samba*.tar.gz
$ cd samba-3.0.13
$ ./configure --prefix=/usr/local/samba --with-ldap --with-ads --with-krb5 --with-pam --with-winbind
# make && make installIn
your smb.conf:
----8<-----
netbios name = LINUX_SERVER_NAME
realm = DOMAIN.COM ads server = 123.123.123.123
security = ADS
encrypt passwords = yes
----8<-----
start samba:
# /etc/rc.d/init.d/smb start
To add the linux computer to the AD, you need to log into the DC and add it as a user with such privledges, so (from the Linux system):
# /usr/local/samba/bin/net ads join -U Administrator
it should prompt you for Administrator's password. Note that Administrator should be a user with the right to add a computer to the AD.
you should see something like:
Joined 'LINUX_MACHINE_NAME' to realm 'DOMAIN.COM'

To verify this worked, go to the windows DC and open Active Directory->Users and Computers and look for your linux machine to be listed there.
That's all you absolutely need to connect to the AD. If you want to map users to the AD (which is probably why you're doing this), open /etc/nsswitch.conf and change this:
passwd: files
shadow: files
group: files
to this:
passwd: compat winbind
shadow: compat
group: compat winbind
start the winbind daemon:
# winbindd
make sure it's running:
# ps -ae grep winbindd
if nothing gets returned, you probably didn't configure samba with kerberos and ldap support. If it shows winbindd running, you're all set. To make sure everything starts on reboot:
open /etc/rc.d/init.d/smb and /etc/rc.d/init.d/winbindd and make sure the line:
# chkconfig: 345 NN NN exixts (NN will be different numbers pertaining to priority), it should be on line 3 of both files. if these lines don't exist, add them. If they read:
# chkconfig: - NN NN change the - to 345 save and close those files and run chkconfig:
# chkconfig smb reset
# chkconfig winbindd reset you can check the runlevels they will start at with # chkconfig smb --list
# chkconfig winbindd --list
That should about cover everything.

Samba Config

0 comments

Samba is a suite of applications and daemon processes used on *nixmachines primarily for communicating with win* machines for sharingfilespace and printers.
Samba is a suite of applications and daemon processes used on *nixmachines primarily for communicating with win* machines for sharingfilespace and printers. Developed by a Pizza Lover, Andrew Tridgell,Samba is based upon SMB (Server Message Block) protocol whichdescribes rules for communication among various machines on a network(for sharing filespace and printers). If you still don't understandwhat SMB protocol is, just launch Network Neighborhood (assuming youwork on windows), and what you see is a live demonstration of SMBprotocol. So, you can call Samba network neighborhood of *nix (Assuch, I prefer it the other way round ;-). Samba's flexibility andfunctionality are unmatched and it's performance has been a matter ofconcern for M$. Apart from sharing filespace and printers, it offerssome more services like.. (I'll be surprised if I have come up with acomplete list ;-)
1. It can act as a Local Browse Master for a Workgroup. Supportsdomain logon and logon scripts. Supports browsing on other subnetsand also supports replication of Browse list across subnetboundaries. (Phew!!)2. It supports a 'Shared User Database' with all the servers in adomain sharing a distributed NIS or kerberos authenticationdatabase.3. It can act as a WINS server.4. It supports SMB password encryption scheme.5. It can be turned into a Fax Server.6. It can take backup of PCs directly to a tape.I come back to the focus point of this article now; sharing filespaceand printers using Samba. Hmmmmm. I think the discussion can bebranched into sharing your filespace and printers with others andsharing others filespace and printers with yours.Sharing your filespace and printers with others:This is accomplished in terms of services (shares in windows). Theconcept is simply that your machine offers services to other machineswhen it lets them read from/write to your drive or when it lets othersprint on your printer. Services are created by configuring/etc/smb.conf (In fact, smb.conf is the backbone of Samba Suite).Samba offers so much flexibility in making the services that it can bereal fun for a creative mind. This is accomplished by the followingcomponents of Samba suite....smbdsmbd is a daemon process that plays key role in providingservices. It listens to the service requests from othermachines and responds as specified in /etc/smb.conf (got theimportance of this file? ;-)nmbdnmbd is a daemon process that understands and replies tonetbios name service requests. Whenever its own name (themachine it's running on) is specified, it responds with the IPaddress of the machine it's running on.smb.conf This is the configuration file for Samba. All daemon processesof Samba suite read this file which makes it extremelyimportant. I advise you to go through man pages and how-tosbefore you sit down to edit this file. If you don't feel likedoing it, I have made an attempt of writing a generic file thatshould satisfy your needs. You can use it but the condition isthat you will have to tell me how bad it is so that others findit a little less bad ;-).testparmOnce smb.conf is edited to meet your requirements, you have tocheck it's validity. Here testparm comes for your rescue!! Itcan point out most of the blunders that your smb.conf is likelyto cause.testprnsThis one points out printing related blunders.Sharing others filespace and printers:This is accomplished by a host of commands...smbclientsmbclient lets you inquire about the services a machine offers.All you have to do is smbclient -L hostname and it lists allthe services of hostname. If you want to browse through aservice, just do smbclient \hostservice. It will give youan ftp like interface.smbmountCall it mapping hostservice on drive U:!! You need to accesssome services quite frequently. smbclient is good for quickbrowsing but not feasible in such a case. So, here comessmbmount. It lets you mount hostservice on a directory justthe way you mount any filesystem. Just do smbmount//host/service /path_to_mount_point and it's done. Access thefiles/printers just as they are attached to your machine!!!smbumountWell, it's obvious!! You may want to unmount the filesystemonce you are through with your job. Just do smbumount/path_to_mount_point and ....nmblookupIt finds the IP Address of a machine given it's netbios name(the name by which a machine appears in Network Neighborhood).LinNeighborhood Just don't forget to pick it up. It's a do-all application witha nice GUI for Samba. A pretty good substitute of the abovefour commands if you find command line a little messy!!"What about Network Neighborhood?", They asked.I smiled and launched LinNeighborhood....Besides these, there are a few other, distribution specific commandswhich I have not described. Please refer to the documentation thatcame with your distro."So, you have Network Neighborhood also on Linux!!", they mumbled.

Samba NT Domain Controller

0 comments

Currently, Samba can go beyond merely emulating Windows shares to actually acting as the Primary Domain Controller for your Windows network. Of course, Samba can also become a NT domain member. In this article we shall look at both these options.
The domain concept is much better than the traditional workgroup concept. One of the primary benefits is having a centralized password database on the Primary Domain Controller. Once authenticated, you can access any of the shares in the domain, without having to re-authenticate yourself.
If you're unfamiliar with Samba, then we've got a couple of good howto's that you can refer to. Look for links to them at the bottom of the article.
Samba as a NT Domain Member
Samba emulates a NT workstation when becoming part of the domain. So, the first thing you need to do is create a machine account for your Samba machine on the domain controller. In NT you would use the program Server Manager for Domains to create the account. Once the account is created, all you need to add are the following lines to your smb.conf file under the global section.
# Your Workgroup or Domain that you want
# to login to
workgroup = FREEOS
# Tell Samba to talk to domain controller
# for authentication
security = domain
# Specify the server to get authenticate
# from. You can specify the
# NetBIOS # names of the servers or simply
# put in a "*" here to let
# Samba find the server through broadcast
password server = PS1 PS2
# Make sure Samba is using encrypted
# passwords
encrypt passwords = yes
Now stop the Samba daemons
/etc/rc.d/init.d/smb stop
Give the following command to join the
NT Domain
smbpasswd -j DOMAIN -r DOMAINPDC
DOMAIN here is the domain that you want to log on to. DOMAINPDC is the primary domain controller for that domain. You will then see a message saying, “Joined domain DOMAIN”.
Now start your SMB and NMB daemons.
/etc/rc.d/init.d/smb start
That was all about joining an NT domain. Setting up Samba as your Primary Domain Controller is not very difficult.
Samba as Primary Domain Controller
Add the following to the global section of your smb.conf file.
# The domain you want to be a PDC for
workgroup = SIMPLE
# Tell Samba to use domain logons
domain logons = yes
# User-level security. Users must
# authenticate themselves with
# valid username and password
security = user
# Set to yes so that nmbd participates
# in local master browser
# elections
local master = yes
# Set Os level value to make sure nmbd
# wins local browse master
# elections. 65 should beat everyone
# according to the man page
os level = 65
# Give nmbd an advantage in local
# master browser elections
preferred master = yes
# Set so that nmbd claims a unique
# NetBIOS name identifying it as
# a domain master
domain master = yes
# The following share is required to support
# domain logons. The directory may be
# created anywhere on your system. Make
# sure the share is non-writeable and also
# not a public share.
[netlogon]
comment = The domain logon service
path = /usr/local/samba/netlogon
public = no
writeable = no
The next thing to do is create the users on the Samba server that is to act as the domain controller. You can do this using the useradd command.
useradd –-g smbuser –-d /dev/null –-s /dev/null ntuser
As you can see, both shell and home directory for ntuser is set to /dev/null. If your Windows users are not required to access the Unix box, you should use the above to deny access to the machine. Passwords are also not required to be set because Samba keeps the password hash in a separate file specified in the configuration file.
# Path to Samba password file
# Make sure only root has read/write access
smb passwd file = /usr/local/samba/smbpasswd
After adding a user (you can also use vipw to add a user), you need to add the user to the samba password database.
“smbpasswd –a” will add all users in Unix passwd file to smbpasswd file. The usage and syntax is similar to the Unix passwd command. To change a users’ password use “smbpasswd username”.
That will be enough for Samba to start authenticating Windows 9X clients. For NT workstations, some more work is to be done. You have to create a machine account for each NT client that will logon. A machine account is simply a regular /etc/passwd entry, with a “$” appended to the name of the NT machine.
useradd –-g smbuser -–d /dev/null -–s /dev/null ntclient$
Now add it to the password database
smbpasswd –a –m ntclient (the $ at the end is not required)
Samba can now accept logons from a NT client.
As you can see, configuring samba as a domain controller and domain member is a fairly easy job. The flip side is that since samba is the result of major amounts of hacking and reverse engineering, it doesn’t have all the functionality of a proper domain controller. There is an alternative branch, Samba TNG that adds more functionality in this area.

Access linux shares from windows

0 comments

The cute-looking Tux had a problem. Everyone thought Tux disliked Windows and therefore wouldn't talk with anything that had 'Win' in it. This thought spread around quite a bit, and therefore most Windows users would have no truck with tux.
But getting Windows to recognise a Linux machine or for that matter getting Linux to recognise Windows-based computers in a network is as simple as configuring your network in Windows.
See-through LinuxWhile Windows uses the popular Network Neighborhood to view other machines, Linux allows other Windows users to view a Linux-PC using a utility called Samba. Samba emulates the Linux machine as a Windows machine and thus allows you to share resources on the hard drive along with the appropriate security roles. Using Samba, it is also possible to share printers or use Windows-based network printers.
However, there are some basic steps that need to be performed before you get your Windows and Linux computers to talk to each other. For example, you need to set the security modes, specify the share names, etc.
Samba for startersBefore starting off the installation and configuration of Samba on a Linux computer, make sure you have the network components set up perfectly. You can find Samba in almost any Linux distribution media. In fact, it is usually installed when you install a Linux distribution. In case the Linux distribution that you have installed or used does not have Samba, you can always download the latest release from the Samba site.
The configuration of Samba doesn't vary from distribution to distribution, so let's see how you can get it right in Red Hat. Before installing any package, you have to be logged in as root. So, type su root at the command prompt or use the X interface to log off from the normal user to root. For installing the packages, Red Hat users can use gnorpm from X. Otherwise, those comfortable with the command line can install Samba using the following command:
rpm -ivh samba-2.i386.rpm
In case your distribution gives you an error that says missing dependencies while installing Samba, install the missing components first or else Samba will not get installed. Once you have successfully installed the Samba daemon on your system, you can move on to configuring it.
Samba sharesFor Windows-based PCs to view your Linux machine, you have to configure Samba. You can either use the graphical interface or manually edit the Samba configuration file. (/etc/samba/smb.conf). Start up your favourite text editor, and open the smb.conf file. There are various sections that you can change depending on your needs, but the most basic is where you just specify the share name, the path and the user rights. Go to the section marked as
[tmp] comment = Temporary file space path = /tmp read only = no public = yes
The [tmp] name denotes the name of the share that will be displayed when anyone tries to access your machine through the Network Neighborhood. The comment tag describes the information about the share [tmp]. The most important line is the one about the path, where you specify the folder which has to be shared. Ensure that the folder has the appropriate security settings to allow others to read or write to it. The read only = no line means that people can also write on the share. The same read only = tag can be made yes to make it only readable by users. The public = yes tag makes the share available for all the public around to see. Similarly, public = no will not allow everyone to access the share; only the particular user will gain access. At the same time, in the security section, change the security to share if you are not using Windows NT domain.
If working with text-based commands is too difficult, then there are graphical interfaces that also allow you to configure Samba. The KDE desktop environment, for instance, has a utility called Ksamba. GnoSamba is a Gnome program for configuring your smb.conf and other Samba files accordingly. This helps in creating and editing Samba shares very efficiently and also easily. There are many other Samba utilities that ease your task and give you more control over the shares.
Maps of the worldAfter you have finished installing and configuring Samba on your Linux distribution, you can go to any machine on your network and see your computer along with the other Windows machines. Like with any other networked computer, you can map the Linux share as a drive. You can access your Linux machine from other *nix systems using smbclient, a Samba client that allows you to connect to a Samba server.
smbclient -L - machine gives you a list of all shares on a particular machine.
smbclient file://testmachine/share allows you to access the shared folder 'share' on a computer called 'testmachine'.
smbmount file://testmachine/share /mnt mounts a share called 'share' from the testmachine computer on a directory called mnt.
If you have smbclient installed on a Windows-based machine, you can use the same commands on that machine too.
Linux in your neighbourhoodTill now, you have seen how your Windows machine can access Linux computers. Even Linux computers can access shares on a Windows PC in an easy way using utilities such as Linneighborhood or XSM Browser. Linneighborhood is a clone of the Windows-based Network Neighborhood and allows users to browse through Windows-based networks. You can mount (map as in Windows) the different Windows shares.
XSMBrowser is another utility for viewing a Windows machine and has an interface similar to that of Netscape Navigator. The installation of XSMBrowser can be done using the Red Hat binaries or by compiling the source.
Lin-Win talkAs you can see, getting Linux and Windows to talk to each other isn't difficult at all. There are other methods also to get Linux connect to Windows clients, but by far what we have outlined here are the simplest methods. And considering the number of graphical utilities that are available for this task, you needn't even bother with any command line parameters. We just had a basic look at sharing files using Samba, but there are many more alternatives such as the Andrew File System (AFS). Better interfaces are the order of the day, and the Windows-Linux network may soon seem an integrated whole.