Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Thanks. I don't want to edit it. I wanted to look at it as I thought someone said that it contained IP addresses, so I am curious to see what the file looks like.
"sudo more .ssh/host_rsa_key" or "sudo more .ssh/host_rsa" ----- I'll try them.
Tried it in terminal, didn't work.
According to your last post, the name of the file is ssh_host_dsa_key.text — or, if that was just a copy, ssh_host_dsa_key
"sudo more .ssh/host_rsa_key" or "sudo more .ssh/host_rsa" ----- I'll try them.
Tried it in terminal, didn't work.
You can just use cat, they're not all that long.
That said, the "private" key just is a stream of seemingly random characters between the -----BEGIN and -----END lines, there is no user meaningful info there.
The public key is a bit more informational as it's meant to be shared:
it starts with the cipher (ssh-rsa, ssh-dsa or so), then the actual key and at the end the user@host of the system it's supposed to be used against.
Thanks. I'm trying to open, in terminal, the file: "ssh_host_dsa_key" using "sudo xdg-open ssh_host_dsa_key" and keep getting ""Unable to detect the URI-scheme of "ssh_host_dsa_key""
My guess is that it needs a file extension.....?
Thx.
Linux does not, in general, use file extensions. Ever, really, except for certain things it needs the sysadm to pick out at a glance (like .conf). Some programs recognize certain file extensions, but they are really only used by humans to recognize file types. People very familiar with the Linux way use the 'file' command to determine a file type, but even that is not needed here. The file type is TEXT and it is human readable. The command line
Code:
cat ssh_host_dsa_key
will dump it to the terminal so that you can read it.
Linux does not, in general, use file extensions. Ever, really, except for certain things it needs the sysadm to pick out at a glance (like .conf). Some programs recognize certain file extensions, but they are really only used by humans to recognize file types. People very familiar with the Linux way use the 'file' command to determine a file type, but even that is not needed here. The file type is TEXT and it is human readable. The command line
Code:
cat ssh_host_dsa_key
will dump it to the terminal so that you can read it.
Thank you. Is there an article or something you could point me to for creating new (4) host files? I think I was told that one or all of the host files are used to identify my computer on the web, regardless, I know that someone said that with the private host keys that they could launch MITM attacks.
Since someone may have been on my computer when I was in root, I would like to replace them with new host files. If not all of the host files can be used to identify me on the web, private host files, please let me know as there may not be a good reason to replace them. Thanks.
Thank you. Is there an article or something you could point me to for creating new (4) host files? I think I was told that one or all of the host files are used to identify my computer on the web, regardless, I know that someone said that with the private host keys that they could launch MITM attacks.
Since someone may have been on my computer when I was in root, I would like to replace them with new host files. If not all of the host files can be used to identify me on the web, private host files, please let me know as there may not be a good reason to replace them. Thanks.
Well, host files do not identify the person, only the host machine originating the connection. That said, if you want to understand using, creating, and identifying the files I would start with the info or man pages for sshd (and, to some extent, ssh).
While not intended to be instructive, the documentation provided by the maintainers as info or man pages is almost always a good place to look first. Answering such questions about the product and using it is why those pages are built and maintained. If they do not answer all of your questions, they do provide you with enough information to prompt your search terms for google, duckduckgo, or other search engines to find tutorials or other online discussion of the topics of interest to you.
Well, host files do not identify the person, only the host machine originating the connection. That said, if you want to understand using, creating, and identifying the files I would start with the info or man pages for sshd (and, to some extent, ssh).
While not intended to be instructive, the documentation provided by the maintainers as info or man pages is almost always a good place to look first. Answering such questions about the product and using it is why those pages are built and maintained. If they do not answer all of your questions, they do provide you with enough information to prompt your search terms for google, duckduckgo, or other search engines to find tutorials or other online discussion of the topics of interest to you.
Thanks. I don't want to edit it. I wanted to look at it as I thought someone said that it contained IP addresses, so I am curious to see what the file looks like.
"sudo more .ssh/host_rsa_key" or "sudo more .ssh/host_rsa" ----- I'll try them.
Tried it in terminal, didn't work.
It would not be in them files anyways, they only contain the key where you will find an ip if it puts it there is in the known_hosts file. On my Debian system it does not put them in there on my Mac it does put the IP associated with the login.
Code:
MacUser2525:~$ haswell
Linux haswell 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jul 10 22:50:30 2019 from 192.168.0.3
seeder1@haswell:~$ cat .ssh/known_hosts
|1|fE4QtF7r64JOdqo6iTKctlpZ7+I=|o2ZnrFx0aW3mA/a4oEh58BeUKbE= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAWqgf65MjC7kXwbvAR7kzg1CJjLVg2IF7j5IIOi6bZHP6pe2zKzwM6df//d6Gdl8uwni2ZMFn7MLp+J6ED8hDA=
|1|i0NhLgqxOE7wlqiYLpD41zOXi5w=|8OEKCuV2ZiapE9z/U6SIdnnO7F4= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM6OpjR8XZfsY+Woc1tT/tPhmx7PaqucFXVAE+njccOvh4J9VUz0JUFOCj+5zwdmzxMqJ9dh+dWUCq+ghLYDFUw=
Oh and if you use the proper name for the file in terminal then it shows you no problem the contents of the file no sudo is needed you as the user who generated the file have all the permissions necessary to do anything you wish with it..
Well, host files do not identify the person, only the host machine originating the connection. That said, if you want to understand using, creating, and identifying the files I would start with the info or man pages for sshd (and, to some extent, ssh).
While not intended to be instructive, the documentation provided by the maintainers as info or man pages is almost always a good place to look first. Answering such questions about the product and using it is why those pages are built and maintained. If they do not answer all of your questions, they do provide you with enough information to prompt your search terms for google, duckduckgo, or other search engines to find tutorials or other online discussion of the topics of interest to you.
Thanks. "Well, host files do not identify the person, only the host machine originating the connection.
If none of the 4 "host files" have an ip for my computer, do the host files (still) identify my host machine originating the connection?
Thanks. "Well, host files do not identify the person, only the host machine originating the connection.
If none of the 4 "host files" have an ip for my computer, do the host files (still) identify my host machine originating the connection?
Understand, those host files, specifically the keys within them, are far more unique to your host than the IP address of your host. Your IP address can, and in an environment where DHCP is used probably will, change on a regular or semi-random basis. The host keys will change only when you change them or they expire and are regenerated. In a NAT environment the external IP address will differ from your host IP address anyway, but the host keys will uniquely identify your host. (That is, in fact, EXACTLY what they are FOR! Identification of a trusted host, so that you can detect when a connection is from a new or 'untrusted' host.)
I normally change authorized_keys and known_hosts to restrict the permission to 400 too, as not to make it too easy for "other users" to find out which systems are authorized cq known to me.
And in my version of known_hosts it is both the hostNAME and the hostIP that is included, but more modern versions of ssh obfuscate them when they add new entries. Old entries, like this
I normally change authorized_keys and known_hosts to restrict the permission to 400 too, as not to make it too easy for "other users" to find out which systems are authorized cq known to me.
And in my version of known_hosts it is both the hostNAME and the hostIP that is included, but more modern versions of ssh obfuscate them when they add new entries. Old entries, like this
Code:
tepper,192.168.178.3 ssh-rsa AAAAB(etc)
are not changed, though.
Just one comment: Those mentioned in your post are the USER ssh files, not the host files. Thank you.
Those mentioned in your post are the USER ssh files, not the host files.
I know, but in the message I reacted TO (from HappyTux) they were user files too, he listed the .ssh subdirectory.
The host itself only has key files, no "known_hosts" nor "authorized_keys", in fact the host doesn't have a .ssh subdirectory where those files would be located.
But, as I said, I extra protect the /root/.ssh contents by changing all files in it except the public key to permission 400, so other users can only get the public key (which is public anyway).
If none of the 4 "host files" have an ip for my computer, do the host files (still) identify my host machine originating the connection?
The public keys are meant to be put onto remote machines, so yes, they DO identify either IP or hostname from the system which they are from, in a root@hostname or root@ip_address form as they should be used for secure connections to THAT machine only.
BTW: the "host files" are pairs (private and public key) and there can be at least 5 pair of them (of which 1 is only for ssh protocol level 1, so if you got that disabled, those may nog have been generated on your system):
Code:
ssh_host_key ssh_host_key.pub Protocol level 1 keypair
ssh_host_dsa_key ssh_host_dsa_key.pub and
ssh_host_rsa_key ssh_host_rsa_key.pub The "original" level 2 dsa and rsa files
ssh_host_ecdsa_key ssh_host_ecdsa_key.pub Newer ecdsa keys
ssh_host_ec25519_key ssh_host_ec25519_key.pub Still newer implementation of the ecdsa cipher
At least, those are the type of "host files" I got on my system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.