LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Hostname persistant (Samba issue) (https://www.linuxquestions.org/questions/linux-newbie-8/hostname-persistant-samba-issue-714712/)

PhilipMiddleton 03-26-2009 07:46 PM

Hostname persistant (Samba issue)
 
How do I make the hostname stick?
Running Mandriva 2008.1 + Samba (user level shares)
Sharing a few folders, but when the hostname is localhost, the Windows machines complain about duplicate name when they login to the share, and hence wont work.
If I run the command line
hostname Linux01
then restart the smb service, then all OK (shares work great) until the next reboot.
a reboot resets the hostname to localhost and the windows machines complain again.
Adding the machines ip and name to /etc/hosts dont work.
what have I got to change to make the hostname stick after a reboot?

Thanks... Philip.

jman82s 03-26-2009 08:07 PM

I've never used Mandriva myself, but it is based off of Red Hat, which uses the file /etc/sysconfig/network to set the hostname. Debian-derived distros (and possibly others?) Use the file /etc/hostname to set it.

Hope that helps!

PhilipMiddleton 03-27-2009 12:10 AM

Quote:

Originally Posted by jman82s
/etc/hostname

.
As you suggested, this file does not exist

Quote:

Originally Posted by jman82s
/etc/sysconfig/network

.
Ah. This file only has NETWORKING=YES
so I have added hostname=linux01 (same as samba name)
will reboot now, see how this goes

PhilipMiddleton 03-27-2009 03:15 AM

Well, entering that extra line in the /etc/sysconfig/networking file has had a somewhat unexpected effect.
I can now get into the Linux shares perfectly, but the Lunix hostname (type hostname from a prompt) is still localhost.
I dont think I did anything else, but like I said, Samba is now working.
Very strange, but hay. Not going to argue with it (atm).

On to the next problem. While I can see the Linux shares on a WinXP machine, I cant see any Windows shares (including printers) on the samba machine. But, if I type smb://username@pcname/sharename (ie smb://philip@philippc1/data) into Konqueror or firefox, I can see and use the share no problem.
I'm trying to see the shares from MCC > Network Shareing >Windows Shareing (smb)...
Is there a better place to Browse available shares?
Is this a common problem?

Thanks... Philip.

jman82s 03-27-2009 04:12 PM

Glad to hear you got the hostname situation laid to rest. I'm not sure why it still shows up as 'localhost' on the actual machine. It might have to do with the entry in the /etc/hosts file, which maps your local loopback address (127.0.0.1) to the name 'localhost'. Which should not be tampered with, as various programs need this for functionality.

I actually have very little experience with Samba. I'm more of an NFS guy, so I'm not sure where the best place to browse is. I always felt a little funny browsing files from a web browser, but I'm guessing you're probably safe enough.

Any other takers? Suggestions?


All times are GMT -5. The time now is 08:46 AM.