Linux doesnt see most file extensions - there are some exceptions. Is smb.conf one of them? Linux n00b


It can be renamed to smb.bak for a backup so Im presuming its one of the exceptions.

I speed read Linux doesnt need most file extensions but dont recall it all.  Can you explain why it hasnt and how it manages without the need extensions like windows?

Thanks
fcekAsked:
Who is Participating?
 
farzanjCommented:
Unlike Windows, Linux does NOT care about your file extensions.  You can make files without ANY extension, you can make file with names like name.longextension and you can also make like this.is.my.file.  It does not categorize files like that.

One way Linux does is by -- analyzing file type.

So if you do

file <filename>

It would tell you the file type.
0
 
farzanjCommented:
Conf is also no exception.  It is just to make it readable to you.  If you wish, you can make extensions like txt or .dat or whatever.  But as I said, the OS would not classify it with the extension names.  It would do it as you see in the file command
0
 
dileepan_kCommented:
It is the file content that makes the difference here. Also, permissions attached to file (ls -l listing) tells you, if the same can be executed, read, updated.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
tsmgeekCommented:
samba will always look for smb.conf as its starting file, after that you can include any filename from within smb.conf to extend it
0
 
fcekAuthor Commented:

So how does samba know which file to read?  The first two are backups

-rw-r--r--    1 root root 12672 Mar  8 18:04 smb.bak
-rw-r--r--.   1 root root 11831 Mar  7 22:17 smb.bk
-rw-r--r--    1 root root 15043 Mar 23 02:10 smb.conf
0
 
fcekAuthor Commented:
0
 
farzanjCommented:
It is included in the binary -- the programmer wrote it this way.

if you get the source code and change the name to fcek.configuration, you can.

I would like you to issue this command as root
 
strings $(which smbd) | grep smb.conf

Open in new window


The above command shows you the string contents of the binary, which the information is stored as to which file it is supposed to read.

In Unix/Linux some times there environment variables setting the names of files to be checked.
0
 
tsmgeekCommented:
its not directly written by the programmer, when the program is compiled there is an option to specify where the config file is, some users like it in /etc/samba/ others in /usr/local/etc/ etc etc, it can be overriden though by a file in /etc/sysconfig/samba, you add -s smb.xxx etc to the start params
0
 
farzanjCommented:
Well pointed out by tsmgeek.

I didn't want to go into these details-- typical programming practices are to keep various values configurable at various levels, by using install options, etc.

Yes I changed to line in /etc/sysconfig/samba to read as
SMBDOPTIONS="-D -s /etc/samba/smb.config"

And now it reads from the above mentioned file, as its config file.
Thanks tsmgeek for pointing at out.  Nonetheless, the binary contained the name of file as I mentioned above and the command.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.