Re: open ssh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/4/19 4:40 PM, Angelo Moreschini wrote:


currently I perform operations between different computers in my local network using open SSH; however, when I do this, I always use the computer's IP number to reference the host. (ex: sudo ssh angelo_dev@10.0.0.15)

I'm wondering without yet finding an answer how to do the same thing using (instead of the IP address) the name of the computer ..
Do I have to Installase BIND? And then what else is needed? ...

thanks for every suggestion

Angelo

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Hi!

A quick way to fix that would be to set up a config file under .ssh to list username, machine IP and eventually SSH keys and then add a nickname for that machine.

I have that in mine:

Host machine_nickname
    Hostname 192.168.0.1
    User fred_onfedora
    IdentityFile ~/.ssh/nickname_rsa
    PubkeyAuthentication yes


And then for a machine where I use password (didn't manage to make keys work yet and tired of typing the password I use a python scrypt which I probably found on stackexchange:

!/usr/bin/python                                                                                                                       
from ConfigParser import ConfigParser
import pexpect

def main():
    url = "" class="moz-txt-link-rfc2396E" href="mailto:fred_onfedora@192.168.0.2">"fred_onfedora@192.168.0.2"
    user, host = url.split('@', 1)

    cfg_file = '/home/fred/bin/ssh.cfg'
    cfg = ConfigParser()
    cfg.read(cfg_file)
    passwd = cfg.get(user, host)

    child = pexpect.spawn('ssh -p 54 {0}'.format(url))
    child.expect('password:')
    child.sendline(passwd)
    child.interact()

if __name__ == '__main__':
    main()

then as you can guess I have a ssh.cfg file set to 600 containing this:

[fred_onfedora]
192.168.0.1 = mypasswordhasnospace

Both work for me.

Hope this helps you.

Fred
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux