UTC 14:14:56

June 2024
Calendar Tool


Networking - Linux Reference

Here are some solutions to problems Linux users often encounter. If you have a better solution or
have a question please send your solutions, questions, or comments to us.
Are any of these solutions obsolete? Are they clear and easy to understand?


How do I telnet to my linux server as root from a remote client?

look for 
uncomment ttys01-3 ttyp01-3 (that is, ttys01, ttys02, etc...)
also  note that /etc/login.defs contains login securetty info.

Remove file /etc/securetty
or just rename it.
There should be a better solution to this though. If you have a better
solution, please e-mail me.

/etc/rc.config sets lots of stuff including
allowing root login via telnet
edit it then /sbin/SuSEconfig*
I think I saw something in YaST once.

Quick guide to getting samba up and running?
Simple config:
  1.config /etc/smb.conf
  2.smbadduser unixuid=ntuserid <---- example: root=administrator
  4./etc/rc.d/init.d/smb restart <---- this restarts samba
  1.config /etc/smb.conf
  2.smbpasswd -a user<----change passwd add user
  3./etc/rc.d/init.d/smb restart <---- this restarts samba

Config /etc/smb.conf

For the impatient here's a very simple but working /etc/smb.conf file.
This is for those who don't read anyway:



# workgroup = NT-Domain-Name or Workgroup-Name
# You MUST change this to reflect your workgroup or domain
    workgroup = MyWorkGroup_OurFamily

    server string = Samba Server

    log file = /var/log/samba/log.%m

    max log size = 50

    security = user

    smb passwd file = /etc/smbpasswd

    username map = /etc/smbusers

    socket options = TCP_NODELAY

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# this has been changed in version 1.9.18 to no.
    dns proxy = no

    comment = All Printers
    path = /var/spool/samba
    browseable = no

    guest ok = no
    writable = no
    printable = yes

    available = yes
    path = /
    public = yes
    guest only = yes
    writable = yes
    browseable = yes
    only user = no


Now for those of you who want to see the whole file, here it is:
Right click and choose save as
This will make the root directory "/" of your samba server look like
another windows machine to actual MS Windows users. You can change "/" to
whatever directory you like; it will appear as the root directory to
windows clients.

To add a new user, use this smbadduser
  smbadduser unixuid=ntuserid <---- example: root=administrator
So, if you are root on linux and you are administrator on windows,
you would use the smbadduser command like this:
  smbadduser root:administrator
or if you are user joe on linux and you are user joe on windows,
you would use the smbadduser command like this:
  smbadduser joe=joe

If you don't see the smbadduser command, but you do see the smbpasswd
command, then you can skip the smbadduser procedure.

Now, change the user password. It would be better to make your smb
username and password match that of your windows username and
password. It would avoid many problems.
  smbpasswd -a joe
It is also possible to use smbpasswd to add user and set the password.
The above command adds user joe and changes his password.

Now you need to restart samba. You don't need to reboot, just restart
  /etc/rc.d/init.d/smb stop
wait one second...
  /etc/rc.d/init.d/smb start
You must type in the full path.

It is possible that your particular distribution and kernel version is
buggy and less stable, you may want to reboot.

Windows 95, Win98, and Windows Millennium will easily see samba.
Windows NT 4 and Windows 2000 will work fine without any modifications
when trying to see samba. They do use encrypted passwords so make sure
samba does that. In the smb.conf file, there's a line for that.
  encrypt passwords = yes
Otherwise windows will cooperate with samba. 

If your Win32 system does not see the samba server it's either not
set up properly or it could be that samba is just not broadcasting.
You can still map to a samba share. You would have to put in the
IP address to samba and the share name.
So, in windows, you have the server name plus the share name of
the shared drive like this:
In the example smb.conf file you would map that drive as:
where you would substitute the numbers with your samba server's
IP address.

How do I run pop3 e-mail?
NOTICE: The following is for slightly older distributions
and some new distributions. For example use the following method
for RedHat 6.2, but not for RedHat 7+ because it uses /etc/xinetd.d
instead of /etc/inetd.conf. If your system uses /etc/xinetd.d, you
need to go into /etc/xinetd.d/ and edit the individual files. Each
file has a disable = yes/no field.

[For most distributions]
Chances are, you've already got it installed. 
You just need to enable pop3:

edit /etc/inetd.conf
uncomment (remove #) these lines:

  pop-2   stream  tcp     nowait  root    /usr/sbin/tcpd  ipop2d
  pop-3   stream  tcp     nowait  root    /usr/sbin/tcpd  ipop3d
  imap    stream  tcp     nowait  root    /usr/sbin/tcpd  imapd

RedHat (and their copy-cats)
Now restart sendmail and inet.
  /etc/rc.d/init.d/sendmail stop
  /etc/rc.d/init.d/inet stop

  /etc/rc.d/init.d/sendmail start
  /etc/rc.d/init.d/inet start

You must type in the full paths.
If you're not comfortable, just reboot your computer.


I'm on a remote computer and I'm trying to send e-mail via sendmail, but sendmail tells me
"relaying denied".

Can't send email, "relaying denied" problem.
This is a security feature of sendmail.
By default, sendmail will only let the localhost send email via.
sendmail service.
In other words, no one else can use it. You need to add your IP.

All linux distributions:
to allow your IP to access sendmail, edit:

add these lines:
-----------------------------   OK
10            OK


The first line says that can access sendmail.
Where can be an outside IP address.

The second line says that all of 10.*.*.* can access sendmail.
10 is the first number of every computer on your network.
If you have the following five computers:
    you would use 10.

Now do this:
makemap hash /etc/mail/access < /etc/mail/access

now, create a file called /etc/mail/relay-domains
add all IP addresses including local and public IPs

now restart your sendmail

RedHat, Mandrake, SuSE, and possiblly others:

/etc/rc.d/init.d/sendmail stop
/etc/rc.d/init.d/sendmail start

note: you must type in full paths. use [TAB] if you are lazy.

That will let you send mail.

To recieve mail see pop3 notes
Then restart networking services. If you are unsure of how
to do that, just reboot your computer.


Some notes on web service.
If you get an httpd problem with an error telling you
that httpd cannot determine hostname, then:

Edit this file: (redhat)

you may get something like this:


Now restart apache web server.
  /etc/rc.d/init.d/httpd stop
  /etc/rc.d/init.d/httpd start

Also (for redhat) run xinit
then start netcfg
make sure hostname is the same everywhere

then restart httpd by
/etc/rc.d/init.d/httpd restart

this will not work
httpd restart
must provide full path
note that /etc/hosts directly affects httpd
set host name there also. must be correct. must match hostname

To change web docs root dirs:

edit files in here:

also note:
(for redhat)

note that this (srm.conf) also contains inportant configs.
to allow .sht files to display a page instead of source code
add this for example:

AddType text/html .sht
AddHandler server-parsed .sht

to remove error and access logs:


rm /var/log/http/*
/etc/rc.d/init.d/httpd restart

Next time someone accesses your web site, new log files will be created.


also edit


How do I create password protected directories?

1. Find this file: /etc/httpd/httpd.conf
   Edit it with your favorite text editor.
     Find the section "DocumentRoot"
       or find: "<Directory" in "<Directory "/system/httpd/www">"
   Now, edit the section so it looks like the following:
      AllowOverride All <--- if you do not see 'All' put it in.
2. htpasswd -c /dirname/filename <username>
    filename and directory is where you want to create the
    htpasswd file. Put it in /etc/httpd/ and call it htpasswd.
    username is a valid username already on your system.
       for example: htpasswd -c /etc/httpd/htpasswd joe
3. Create file '.htaccess' in the directory you want to be protected.
   so if you want to proctect everything in www.yoursite.com/private/
   then you put the '.htaccess' file in private/
    The content of '.htaccess' is:
   AuthUserFile /etc/httpd/htpasswd
   AuthGroupFile /dev/null
   AuthName MyNameIsJohnDoe
   AuthType Basic
   <Limit GET PUT POST>
   require valid-user
4. Restart apache.
     For example: /etc/rc.d/init.d/httpd restart
     You must type in the full path.

Notes: After you have created /etc/httpd/htpasswd with the option -c,
       you can add more users by using htpasswd without the -c option.
       You also do not have to restart Apache.

How do I add more IPs for one linux box? IP aliasing
IP address alias
(1 NIC, many IP addresses)

If running redhat:
either run ifconfig or netcfg

netcfg is easier.
click on the interfaces tab
click on your network card (like eth0)
then click 'alias'
add whatever address you like.

If you choose ifconfig:
  ifconfig eth0 up
This will setup your linux machine to use IP address
To remove that IP:
  ifconfig eth0 down


How do I restrict access to my ftp and telnet service?
Edit the text file:
with a plain text editor.
Start by restricting ALL USERS including yourself.
Add this single line:

  ALL: ALL #this restricts all users

Now, edit this file

You can add any one of these lines:

To allow an IP and port to use a service:
  <service>: <ipaddress> <port>

  ALL: 300
This allows a user behind a firewall to use all services.
The firewall has an IP address of and a proxy server
opens port 300 to that user.

To allow a specific IP to telnet in:
This allows a user at IP to telnet in, but nothing else.
He/She/It cannot ftp or use POP3 for example.

To allow a specific IP to ftp in:
This allows a user at IP to ftp in, but nothing else.
He/She/It cannot telnet or use POP3 for example.


How do I add my ISPs new DNS servers? I want to use their New NameServers.
To add a new DNS server to an exisiting one:
add dns server to /etc/resolve.conf
Just add this one line:

Networking services often stops, how do I get it back up without rebooting?

for redhat:
restart /etc/rc.d/init.d/inet

for SuSE 6.2:
restart /etc/rc.d/init.d/inet
It seems in SuSE Linux, you need to do more than just restart inet.
Even after you restart it, though you can now ping your machine from
another machine, you still can't browse the web or telnet in from another
machine. You will probably have to restart dns services somewhere. 
I don't know. If anyone has a solution for SuSE or other distributions,
Please send it to linux@fusionplant.com


Local access to my Linux server (from my private network (LAN)) "seems" to hang. Two minutes later, I can get in. Outside users (from the internet or web) can access my server without a problem.

You need to edit this file "/etc/hosts".

If you are on a local network only, without internet access and you are
not on other networks then Telnet, FTP, and HTTPd (web) services to
server will be fast to access (login).

In the setup:
local network + gateway + internet access
local network + other networks
Telnet, FTP, and web services to server will appear to hang when
accessed from client machines on a LAN because it does not have a
domain name entry. The server is looking for a domain name entry
and will wait for the DNS server to find one. It will wait and time
out and finally log you in.

For each machine on your LAN, you need to enter it's IP address and a
domain name (any name will do).

You edit /etc/hosts
If your local area network (LAN) is on a 10.0.0.* network, then for each
client machine, you enter:        machine.one        john.smith        mary


I'm using Sendmail 8 or above and I cannot recieve e-mail from the internet.
First thing you need a fully qualified domain name set on your
machine. It should be set in:

enter a line like mycompany.com

enter these lines

Now open:

find this line:
DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')

comment it out with 'dnl' (not #)
so that it will look like this:
dnl DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')

now run this:
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf

Restart sendmail:
/etc/rc.d/init.d/sendmail stop
/etc/rc.d/init.d/sendmail start

To be able to send e-mail, see I'm on a remote computer and I'm
trying to send e-mail via sendmail, but sendmail tells me
"relaying denied".