Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
is there a way to get samba to allow hosts to connect by computer name instead of IP? I am trying to get a share that works from a pc ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790

    Samba allowed hosts


    is there a way to get samba to allow hosts to connect by computer name instead of IP? I am trying to get a share that works from a pc on my network, but i don't want others to be able to access it. i know you can set the hosts allow through IP, but if i'm usiong DHCP, this could change. Is there anyway around this?
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  2. #2
    Just Joined!
    Join Date
    Mar 2003
    Posts
    84
    maybe there is a way for doin it but based on the mac address of the pc, i'm lookin for it onthe internet if i finde anything i'll let you know

  3. #3
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    ok, cool, i hadn't thought of doing it through mac addresses. I may have a look meself. Good idea Dewey! Will post if i find anything aswell!
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jun 2004
    Location
    Leiria - Portugal
    Posts
    72

    Use DHCP

    Hi there,

    I'm reading your post and the solution seems quite simple.

    I'm not sure if you can specify a computer name, or a layer 2 MAC address to work with samba, but if you have a dhcp server (at least if it isn't a simple-router dhcp service) you can tell to dhcp to reserve one single ip address to that machine using the machine's layer 2 MAC address.

    If you're running a dhcpd (linux dhcp server) all that is in your /etc/dhcpd.conf or something like it...

    Hope it helps.
    ---------------------------------------------------------------------------------------------------------------
    Here in Portugal we are using linux as the now solution to many problems....

  6. #5
    Linux User
    Join Date
    Jan 2003
    Location
    Cardiff, Wales
    Posts
    478

    answers

    ok you're using dhcp so you have a range of IP addresses being allocated to your pcs like
    192.168.10.1 ...... 192.168.10.255

    in samba you use the code to allow ip addresses which is something like
    hosts deny = 0.0.0.0
    hosts allow = 192.168.10

    and that should allow anyone from your range in. you can restrict this even more with
    hosts allow = 192.168.10/20

    check the security section of the samba online documentation.
    No trees were harmed during the creation of this message. Its made from a blend of elephant tusk and dolphin meat.

  7. #6
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790

    Re: answers

    Quote Originally Posted by kpzani
    ok you're using dhcp so you have a range of IP addresses being allocated to your pcs like
    192.168.10.1 ...... 192.168.10.255

    in samba you use the code to allow ip addresses which is something like
    hosts deny = 0.0.0.0
    hosts allow = 192.168.10

    and that should allow anyone from your range in. you can restrict this even more with
    hosts allow = 192.168.10/20

    check the security section of the samba online documentation.
    This is not exactly what i want. i want the ip of ONLY my computer to be able to access this share. It is the share of my webserver, and am at university, and have a network of about 12 pc's, i want to start using dhcp as the DNS servers for my isp occasionally go down, so i can solve everybody's problems by changing just that. BUT i don't want them accessing the server's root files. Thinking about it, as i'm the only one to use linux most of the time, i may use an NFS share, but working this out would be useful.
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  8. #7
    Linux User
    Join Date
    Jan 2003
    Location
    Cardiff, Wales
    Posts
    478

    firewall

    ok - ignore the samba stuff. find out what tcp ip ports samba uses and use a firewall to only allow incoming data on those ports to your ip address.
    No trees were harmed during the creation of this message. Its made from a blend of elephant tusk and dolphin meat.

  9. #8
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    Ports 137,138, 139.

  10. #9
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790

    Re: firewall

    Quote Originally Posted by kpzani
    ok - ignore the samba stuff. find out what tcp ip ports samba uses and use a firewall to only allow incoming data on those ports to your ip address.
    this will STILL not solve the problem, as the ip could change through DHCP.....
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  11. #10
    Just Joined!
    Join Date
    Jun 2004
    Location
    Leiria - Portugal
    Posts
    72

    Use DHCPD

    Ok, but the solution remains very easy I think.

    The idea of using a dhcpd server is that you cou'd reserve a ip address, even betwen a range of addresses, to be delivered allways to that machine you want to have access to samba. Then, in samba side, you could specifi that ip on hosts allow sonfig option.

    To do this you'll need a litle of knoleadge of dhcpd but it is very simple to get a small lan server. Also you'll need to know the layer 2 MAC address of the NIC you have in that computer you want to have access to samba.

    Hope you understand, my english...

    I can send you a basic dhcpd.conf file just as an example if you like.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •