[SOLVED] Lost in CentOS

If it doesn't fit in another category, ask it here.
DJay
Posts: 7
Joined: 2011/09/11 21:08:20

[SOLVED] Lost in CentOS

Post by DJay » 2011/09/12 22:01:44

Scottro thank you so much for you help. I solved my problem...kind of. Basically the data and settings in the server didn't change. So, I set the router to use an IP range that would include the server. After doing that the network drive was accessible. Problem solved.
I have been wanted to learn more about Linux. This wasn't the way I wanted learn, but hey. It is a very interesting OS.
Just for your info, because of all your help, Samba is on there. I did a "whereis samba" and it shows it down a long path.

Thanks again for taking the time to help the clueless. I learned a lot.

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: [SOLVED] Lost in CentOS

Post by scottro » 2011/09/12 22:38:47

The trouble is that so much of the documentation is very very badly done--additionally, there are so many small things, that one doesn't know when to start.

A good way to get started is to put it on a virtual machine, for example, install VirtualBox on your Windows machine, and play with it on that.

DJay
Posts: 7
Joined: 2011/09/11 21:08:20

Re: [SOLVED] Lost in CentOS

Post by DJay » 2011/09/12 22:45:14

The documentation is bad, but these forums are priceless.
I was just thinking I have an old Compaq PC that has been unplugged for about a year. I am going to install CentOS on that and learn this thing.
I will be bookmarking this site...lol (seriously)

ddreggors
Posts: 60
Joined: 2007/11/08 05:38:56
Location: Orlando, FL

Re: [SOLVED] Lost in CentOS

Post by ddreggors » 2011/09/28 03:54:20

DJay,

you are almost definitely running samba, it is unlikely that anyone would have setup nfs on those windows servers/desktops.

There are a few ways that you could find where the samba server application lives on that box for the future...



1. RPM (Redhat package manager)
2. lsof (list open files)
3. grep init files


The first and arguably the best method on any Redhat or Suse based linux is as simple as:

[code]
[user@myhost ~]# rpm -ql samba
[/code]

This will list all files installed and their location on the filesystem *if* the samba package was installed using rpm or yum. That is the default method for CentOS and Redhat (Suse uses Yast in stead of yum).


If samba was hand compiled and installed or installed using another package manager... we would have to go for step number two:
[b][color=FF0000]NOTE: This command should be run as root user![/color][/b]
[code]
[root@myhost ~]$ lsof |grep smb.conf
[/code]

or even:

[code]
[root@myhost ~]$ lsof |grep secrets.tdb
[/code]


The first lsof will return all open files that contain "smb" in the name, there will be many. We would then want to look for secrets.tdb as that is usually locate in the applications home (but not always) and that is why I narrowed the grep (filter output by search pattern) to secrets.tdb since that is what we are looking for. Samba uses a config file (smb.conf) but that will not stay open or appear in lsof or ps output since it is read in at start time and then kept in memory. After the inital start and read it is then closed.



Finally, if we know that it starts on it's own it should have a script that exists in "/etc/init.d". It will be named "/etc/init.d/smb", "/etc/init.d/samaba", or as suggested "/etc/init.d/smbd".


Using the grep command we can see where samba keeps it's config file like this:

Assuming the file is "/etc/init.d/smb"...
[b][color=FF0000]NOTE: This command should be run as root user![/color][/b]
[code]
[root@myhost ~]$ grep config /etc/init.d/smb
# chkconfig: - 91 35
# config: /etc/samba/smb.conf
# Source networking configuration.
. /etc/sysconfig/network
if [ -f /etc/sysconfig/samba ]; then
. /etc/sysconfig/samba
[/code]


The output only shows the lines in the file that have the word "config" in them. From that we can see that "smb.conf" lives in "/etc/samba" and also that the extra options file "samba" lives in "/etc/sysconfig"!

The file you wanted to see was "/etc/samba/smb.conf" (your paths may differ).


I hope this info can aid you in the future even if you have already solved this issue. The more you learn your way around the infamous command line the more you will see how powerful it is and you will enjoy using it more and more.


BTW...

for documentation on any of the commands I mention you can use the "man" command on the command line as follows:

[code]
man grep
[/code]
[code]
man rpm
[/code]

Use arrow keys to scroll up/down and when you are done reading you just type ":q" (colon q) to quit. :-D

Post Reply