date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,351,783,683,000
I have two CentOS 7 VM's running in virtualbox. On each of the machines I want to set the hostname and a static IP address. VM1 works just fine. VM2 does not. I did the same thing on both servers so I'm not sure why VM2 is having issues. It shows as localhost.localdomain and I can't get it to read the new correct host...
Try setting the host name in /etc/hostname From the hostname man page on my CentOS 7 machine: The host name is usually set once at system startup (normally by read‐ing the >contents of a file which contains the host name, e.g. /etc/hostname).
CentOS 7 hostname will not change
1,351,783,683,000
Why is it that when I run the command host examplewebsite.com it gives me website's ip, but for some websites, when I type that IP address into the address bar and hit enter, it shows me a 404 page? Shouldn't it take me to the website I got ip from?
The difference is in how DNS and the HTTP "Host" header work. The site you're going to may have multiple sites hosted using the same server. In DNS, all the names for the sites hosted on that IP list the single server IP address. When you enter the name in the browser, the browser sends the hostname to the server usin...
Getting a website's ip with 'host'?
1,351,783,683,000
I am debugging something related to LDAP loggins, Ldap SSH Login not working - Same configs worked on 20+ other servers - Ubuntu and I noticed that in some servers, the logs use localhost and in others they have the hostname. Having the hostname seems to make the most sense, especially if we were to centralize the log...
ERROR: type should be string, got "\nhttps://wiki.archlinux.org/index.php/rsyslog#Configure_Hostname\n\nRsyslog uses the glibc routine gethostname() or gethostbyname() to determine the hostname of the local machine. The gethostname() or gethostbyname() routine check the contents of /etc/hosts for the fully qualified domain name (FQDN) if you are not using BIND or NIS.\n\nMore specifically, if the localhost entry for your IP comes first in /etc/hosts, then it will take precedence.\n(Assuming that files is the first value in the hosts: line in /etc/nsswitch.conf. Or alternatively, that your hostname cannot be resolved using DNS).\n\nThe Arch Wiki page goes on to explain:\n\nYou can check what the local machine's currently configured FQDN is by running hostname --fqdn. The output of hostname --short will be used by rsyslog when writing log messages. If you want to have full hostnames in logs, you need to add $PreserveFQDN on to the beginning of the file (before using any directive that write to files). This is because, rsyslog reads config file and applies it on-the-go and then reads the later lines.\nThe /etc/hosts file contains a number of lines that map FQDNs to IP addresses and that map aliases to FQDNs. See the example /etc/hosts file below:\n/etc/hosts\n#<ip-address> <hostname.domain.org> <hostname>\n#<ip-address> <actual FQDN> <aliases>\n127.0.0.1 localhost.localdomain somehost.localdomain localhost somehost\n::1 localhost.localdomain somehost.localdomain localhost somehost\n\nlocalhost.localdomain is the first item following the IP address, so\n gethostbyname() function will return localhost.localdomain as the\n local machine's FQDN. Then /var/log/messages file will use localhost\n as hostname.\nTo use somehost as the hostname. Move somehost.localdomain to the first item:\n/etc/hosts\n#<ip-address> <hostname.domain.org> <hostname>\n#<ip-address> <actual FQDN> <aliases>\n127.0.0.1 somehost.localdomain localhost.localdomain localhost somehost\n::1 somehost.localdomain localhost.localdomain localhost somehost\n\n\nIt might be hard to tell exactly how the relevant information is selected from /etc/hosts (or the DNS) in various circumstances. Reading the source code again, I think rsyslog tries to resolve the system hostname (output of hostname command) into an FQDN.\nI think this means where it says \"gethostname or gethostbyname\" above, it should really say \"gethostname and gethostbyname\". So those instructions could probably be improved, but they at least point you at the right place.\nThere is also a very similar question asked on the rsyslog-users mailing list.\n"
Why do some of my logs use Localhost and others Hostname - Different Servers
1,351,783,683,000
I'm trying to DENY access to port 1000 when it is being accessed through any host or IP that is NOT a specific host. I.e. If I try to access the service on sub.domain.com:1000 I should get in. If I try to access the service on sub.domain2.com:1000 I should not get in, even though both of these domains are A-records po...
IPTables is working on IP and TCP level, so it doesn't actually know DNS. When a client creates a TCP connection to a DNS name it first looks up the IP address corresponding to the DNS name and then connects to the IP, not to the DNS name. This means IPTables can't possibly know which DNS name a client is connecting ...
How to deny access to specific port when destination is NOT a specific host?
1,351,783,683,000
I'm following this guide and I'm running into issues. https://www.tecmint.com/initial-ubuntu-server-setup-guide/ I am trying to create a linux machine in Ubuntu in wsl2 and then rename it using hostnamectl but have the error Failed to create bus connection: No such file or directory I have tried to follow these solut...
At the core, the problem is that hostnamectl is a systemd utility, which acts on the systemd-hostnamed.service. WSL doesn't currently provide support for systemd. Also, WSL sets the hostname to the name of the Windows computer hosting the instance. While you can change it by changing the Windows hostname (Control Pa...
hostnamectl command causes Failed to create bus connection: No such file or directory
1,351,783,683,000
I was trying to change the hostname on my machine according to this article: https://www.blackmoreops.com/2013/12/12/change-hostname-kali-linux/ When I got to the part service hostname.sh stop sleep 1 service hostname.sh start The hostname will stop correctly it seems, but I can't get it to start. Now, whenever I sca...
The article referenced in your question dates back to 2013 and is outdated. To change hostname simply do the following: Disconnect from the network Run the command hostname new_hostname as root. Connect back to the network
My machine has no hostname "Failed to start hostname.service: Unit hostname.service is masked."
1,351,783,683,000
So due to problems with my hostname I just changed it. The problem with that is that in the tripwire configuration I left the hostname variable within the name of the dbfile and the local keyfile as it was. (like {$hostname}-abc.key) First I tried simply renaming the files to match my new hostname. That didn't work. I...
Ok I solved this now. Here are the steps I took for that: Change your hostname back to what it was before by changing it via sudo texteditor /etc/hosts & sudo texteditor /etc/hostname Reboot computer and check that the name is set correctly by running uname -n Run a check: tripwire --check Check/save/backup the repor...
Changed hostname, now I can't run a tripwire check: "policy file does not match policy used to create database"
1,351,783,683,000
How is 127.0.0.1 related to 127.0.0.2? Using ssh to login to tleilax (OpenSuSE): tleilax:~ # tleilax:~ # hostname tleilax tleilax:~ # tleilax:~ # hostname -f tleilax.bounceme.net tleilax:~ # tleilax:~ # cat /etc/hosts # # hosts This file describes a number of hostname-to-address # mappings for...
your loopback devicelo is bound to the network 127/8 (aka 127.0.0.1/255.0.0.0), thus any address in the range 127.0.0.1 to 127.255.255.254 is your local loopback. therefore, it doesn't matter whether you use 127.0.0.1 or 127.0.0.2. the reason why they (Debian) chose the scheme they chose are explained in the Debian-re...
why are there different formats for the hosts file between OpenSuSE and Ubuntu?
1,351,783,683,000
As you might know, by default, the hostname of an AWS instance is something like ip-12-34-56-78.us-west-2.compute.internal, so when I ssh to this host, the tab name is changed to root@ip-12-34-56-78 (a bit of difficult for me to identify which is which). Since I have the following in the ~/.ssh/config: Host mail.domai...
That should be because upon logging into the remote shell session, that server's PS1 is sending you back the same \033]0;title\007 command sequence which makes your terminal program intercept and display accordingly. You really don't have any effect of editing your PS1 on local workstation. I had a similar requirement...
How to set the tab name to an alias hostname of the remote host I'm connected to?
1,351,783,683,000
I'm running Ubuntu 14.04 and I've recently altered some hostname resolving configs. So I'm now trying to optimise them and for that I need to find out which nameservers resolve particular hostnames in my requests. I can try to ping a hostname my.hostname.example.net to find out if it gets resolved at all or not, but h...
There are several commands that are useful to debug DNS resolution, and to show the path travelled to resolve DNS lookpups: dnstracer Install it with: sudo apt-get install dnstracer example of usage: $ dnstracer www.cnn.com Tracing to www.cnn.com[a] via 193.136.188.1, maximum of 3 retries 193.136.188.1 (193.136.188...
How to find out nameserver which resolves a particular host name
1,351,783,683,000
Currently I uses a big /etc/hosts to block unwanted hostnames. But the file is getting bigger and bigger closing in on 700000 entries. The are many similar entries so I would like to use wildcards like *.co.kr because I don't speak any Korean. Also hostnames that start with a digit or are longer than 64 characters are...
Name resolution is a pretty poor way of blocking undesired web traffic. The list of things to block and not to block keeps changing, and sometimes you need to block per URL and not just per host. Browser extensions such as AdBlock* and uBlock* tend to do a much better job. If you want to write your own list, you can w...
How to block hostnames with wildcards or Regex?
1,351,783,683,000
In linux, when my machine requests an IP address it also sends the hostname back to the DHCP server. How can I stop my machine from sending back this hostname? I use dhclient, possibly via NetworkManager.
You can find host-name in dhcp client configuration to remove or add hostname. For example: Debian / Ubuntu Linux - /etc/dhcp3/dhclient.conf $ sudo vi /etc/dhcp3/dhclient.conf Set hostname as you need on the following line: send host-name "yourhostname"; RHEL / Fedora / CentOS Linux - /etc/sysconfig/network-scrip...
Spoofing or removing DHCP client hostname in response to DHCP server
1,337,608,929,000
I set a new hostname on my machine using: sudo hostname NEWHOSTNAME Then I restarted, and tried accessing the internet and nothing happened. I checked the hostname and it was set to localhost.localdomain. How can I reset my configurations so that I am again connected to the web? I'm running Red Hat Enterprise 6.0 (Sa...
Your hostname should have nothing to do with being able to connect to the internet. That is unless the DHCP server on your network assigns IP addresses based on hostname (which if it does, it's a big mistake). If the internet loss you mention is on a home network, consider restarting your local router. If it's a publi...
I changed my hostname, rebooted and lost internet connection
1,337,608,929,000
I am setting up a RHEL-based server that is associated with dynamic DNS from DynDNS, with a domain of, say, "abc.dyndns.org" that is dynamically updated with the server's IP address. I have read that in order to ensure access to your server's services, you need to have at least the following in your /etc/hosts: 127.0...
Some context: When a program asks your machine to resolve a hostname into a IP address it looks into your /etc/hosts and, if not found, it then makes a DNS query. You don't need to keep a non-loopback IP address on it. You can just usually keep the localhost entries and an alias. See, that's my /etc/hosts contents: [...
Hosts file on server with dynamic DNS?
1,337,608,929,000
I changed the host name and went to make it stick, but my previous solution didn't work. I am using Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/L. Is there a new way to do this (other than reboot)? pi@raspberrypi:~ $ /etc/init.d/hostname.sh -bash: /etc/init.d/hostname.sh: No such f...
hostname.sh has never been the right thing to use. Not only is it one of the van Smoorenburg rc scripts that systemd specifically masks on Debian, but running it was not the way to make a hostname persistent across reboots even with van Smoorenburg rc. It's the script that reads the persistent hostname. The static h...
Is /etc/init.d/hostname.sh still an option for debian stretch?
1,337,608,929,000
Is it possible to make ssh pick a random IP address (using a wildcard) to connect? We have 30 computers with IP addresses from "asd1.asd.asd.asd.com" to "asd30.asd.asd.asd.com", and i want to connect to one of them (randomly selected) using the alias xxxx. Is there a simple way to do this using the ~/.ssh/config file?...
If you really had to, you could do something like this: Host xxxx User my_username ProxyCommand nc asd$((1+$((RANDOM %% 30)))).asd.asd.asd.com 22 This assumes you're using the bash shell -- otherwise you can put the proxy command as the argument for a bash invocation, e.g. ProxyCommand /bin/bash -c "ex...
How to randomly pick one of multiple hostnames under one alias (~/.ssh/config)
1,337,608,929,000
From a user that is part of the sudoers group, I can normally run any command by doing sudo <command> But the following command fails stating "Permission denied" sudo echo "myhostname" > /etc/hostname It doesn't even ask me for the password. How do I change the hostname ?
The correct command in your case will be echo "newhostname" | sudo tee /etc/hostname, because as nssnd explained, sudo applies only to single command, and redirection has less priority than sudo. Another option is to use bash command: sudo bash -c "echo newhostname > /etc/hostname"
Why can't I change the hostname of my server using sudo? [duplicate]
1,337,608,929,000
Content of hostname file in my server is: # cat /etc/hostname sub.mysite.com But when I ping my CentOS 7 server it says: # ping sub.mysite.com 64 bytes from sub ... Even: # ping ns1.mysite.com 64 bytes from sub ... How can I tell my server to have the following output when pinging? 64 bytes from sub.mysite.com ...
ping doesn't use /etc/hostname to resolve IP to name mappings, it uses the Name Service (netns) to do these translations. Incidentally, /etc/hostname is part of systemd: $ rpm -qf /etc/hostname systemd-219-42.el7_4.10.x86_64 That short name you're seeing, sub, is coming from your /etc/hosts file via the Name Service....
How to change `ping from` value when pinging Linux server?
1,337,608,929,000
I get entries like these in /var/log/cron, in a host named SERV2 (RHEL 6.2): Apr 21 14:50:01 SERV1 CROND[14799]: (root) CMD (/usr/lib64/sa/sa1 -S DISK 1 1) Apr 21 15:20:01 serv2 CROND[24438]: (root) CMD (/usr/lib64/sa/sa1 -S DISK 1 1) Apr 21 15:00:01 SERV1 CROND[14838]: (root) CMD (/usr/lib64/sa/sa1 -S DISK 1 1) Entr...
The syslog format typically contains a timestamp, hostname, app name, and process ID along with whatever custom message was sent. All of these values are (substantially) under the control of the process that sends the syslog message. The cronie source (if configured to use syslog) uses the openlog and syslog functions...
Separate server's hostname appearing in this server's cron logs
1,337,608,929,000
I recently created a droplet server at Digital Ocean named: ubuntu-2gb-nyc3-01-2016-03-13 and then did a rename on the server at the Digital Ocean control panel, to exchange.mydomain.com. Furthermore, I did the following command: sudo echo "exchange.mydomain.com" > /etc/hostname And verified it changed by doing nano...
Distros which use systemd use hostnamectl to set their hostname: $ sudo hostnamectl set-hostname exchange.mydomain.com You'll have to log off and back in again to see the change in your shell prompt, but the hostname command will show the change as soon as you've ran the command. Usage $ sudo hostnamectl --help hostn...
Unable to update hostname output for Ubuntu Server (on Digital Ocean)
1,337,608,929,000
We have a server with a CentOS distribution of Linux. It lost its hostname in the month somehow, since our last reboot. We ran an ETL (extract, transform, load) job last week, and part of that process stops JBoss before moving data to our database, and then restarts JBoss after that automatically. The restart faile...
You can specify it (loaded on reboot anyway) in /etc/sysconfig/network with a HOSTNAME= line (see the documentation here) You should specify it as a fully qualified name there generally. If the host doesn't have a name already, and you're using DHCP it will often pick its name up that way.
What is the best way to keep a Linux server's hostname consistent?
1,337,608,929,000
Our accounts in our lab are all mounted over NFS and are accessible over all the systems in a subnet. So, effectively we can ssh into any of the machines in the subnet and continue our work. The problem is that the machines come up or go down randomly because of people accidently turning it off etc. To find running ma...
The Host directive can take multiple hosts, for example: Host *.domain.tld specific-host.tld 10.*.*.* User foo Port 2222 This would set user and port for all hosts matching the star pattern, the explicit host specific-host.tld, or, assuming you type IP numbers, any host whose first IPv4 byte is 10. Then you can add H...
Use a dynamically obtained hostname with an ssh config entry
1,337,608,929,000
Give the example here which has an attempt at setting the hostname to foo.bar.baz for the duration of the build, #!/bin/bash ctr=$(buildah from alpine:3) buildah run --hostname 'foo.bar.baz' $ctr /bin/sh <<-'EOF' echo "/usr/bin/hostname returns [$(hostname)]"; EOF I get the following output, /usr/bin/hostname retur...
I filed this as a bug on GitHub (#2775). It seems it's hardwired but not documented, from irc.freenode.net/#podman nalind> buildah run is hardwired to disable UTS namespace in rootless mode, don't remember why ... nalind> EvanCarroll: unless it's a limitation we put in place for the sake of runc or crun, not being ab...
How does --hostname work with `buildah run`?
1,337,608,929,000
Is there a way I can massage my ~/.zshrc to make the ssh auto-completion autocomplete for the Host, not the Hostname? I have an entry in my ~/.ssh/config that looks like this: Host staging-rfc staging User crmpicco Hostname staging.rfc.crmpicco.co.uk If I type ssh sta[TAB] then it pre-fills the full hostname of s...
Changing my zstyle to the following worked perfectly: zstyle ':completion:*:(ssh|scp|ftp|sftp):*' hosts $hosts zstyle ':completion:*:(ssh|scp|ftp|sftp):*' users $users
zsh ssh autocomplete Host instead of Hostname from ~/.ssh/hosts
1,337,608,929,000
Say I'm on machine local and log into machine remote with ssh, using X11 forwarding. Is there any way for programs running within the ssh session on remote can know they are being displayed on local? Ideally, I'd like to know the hostname of the computer that the X server is running on. My goal is to cause differen...
I don't think the X server reports its host name to clients. The clients are supposed to know the host name that they're connecting to, but over an SSH connection, that's localhost, with ssh doing the forwarding. The OpenSSH server sets the SSH_CLIENT environment variable; you can read the client's IP address from the...
How to find the hostname of an X server
1,337,608,929,000
I have an Ubuntu 11.04 server virtual machine. I would like to request a specific hostname from the DHCP server at the office. Since I don't run it often, the IP changes nearly every time that I boot it. Obviously, referencing it by a hostname is the preferred option. I know that my DHCP server respects DHCP client ho...
I found a solution that works for my network, but your mileage may vary. I'm not sure why it does not happen automatically. Anyway, here's the simple shell script that should update the right nameserver on the right network interface with the right IP (will work for VPN connections, too) and should work on OSX/BSD & L...
How to request a hostname from a DHCP server on Ubuntu?
1,337,608,929,000
I have two computers in the same network with below hostnames and IP address(Dynamic IPs): host1.local - 10.0.0.11 host2.local - 10.0.0.12 host1 is running Docker with default configuration. Containers in host1 are able to connect to host2 using the IP address 10.0.0.12 but are unable to connect to the host2 using th...
Docker containers usually are in the default bridge network: When you start Docker, a default bridge network (also called bridge) is created automatically, and newly-started containers connect to it unless otherwise specified. You can also have user-defined bridges with their own DNS service: User-defined bridges p...
How can docker communicate to other hosts in local network using hostnames?
1,337,608,929,000
How do I rename the RedHat7 hostname without a reboot? I am also trying to automate this task.
[root@stephan ~]# echo stephan2 > /etc/hostname # this is the file that your system reads on boot, to determine the hostname [root@stephan ~]# sed -i s/stephan/stephan2/g /etc/hosts # many networking headaches will ensue if this isn't updated [root@stephan ~]# hostname -F /etc/hostname # reread the hostname file to up...
Rename RedHat7 hostname without reboot
1,337,608,929,000
I tried to change my hostname according to this guide for Debian based system: I edited /etc/hostname I ran /etc/init.d/hostname start Though there are errors. Always when I write a sudo command it tells me it can't recognize the hostname. After I restarted the system, the graphical environment wasn't working, the s...
The problem is that your new hostname can't be resolved to an ip address. There are basically two solutions for your problem. First one but little bit more complex solution is to adjust the hostname in /etc/hosts as well. You will have to adjust /etc/hosts every time you change your hostname. The second and simpler so...
Changing hostname without errors
1,337,608,929,000
The zshmisc man page on my new Debian Squeeze install states, under SIMPLE PROMPT ESCAPES: %m The hostname up to the first `.'. An integer may follow the '%' to specify how many components of the hostname are desired. With a negative integer, trailing components of the hostname are shown. When I include %2m in my pro...
A quick look at zsh's prompt handling source code suggests that %m is based on what your system returns for the gethostname system call. That's like running hostname without the -f option. I'm assuming running hostname without -f returns your bare hostname on your Debian system? You could try changing your hostname t...
ZSH %m prompt escape not working as documented under Debian Linux
1,337,608,929,000
Is it possible to configure where the system will look for the machine if I enter just a short domain name hostname? I work in a grid environment where the machines are many and spread across multiple domains, but they have unique naming, therefore let say skirit23 will only be found as skirit23.ics.muni.cz I could co...
This is usually done by specifying search in /etc/resolv.conf (see man 5 resolv.conf). Example (no more than six domains possible): search ics.muni.cz ncbr.muni.cz fav.zcu.cz
Hostname to fully qualified doman name expansion
1,337,608,929,000
poking docker to see how it works: ubuntu@ip-172-31-14-19:~$ ubuntu@ip-172-31-14-19:~$ sudo docker run --net=host -d -t jmar71n/freepbx 2792243260a8de33d1a775d115188e601fc556e500b5ad085e09b4133d0f3d06 ubuntu@ip-172-31-14-19:~$ ubuntu@ip-172-31-14-19:~$ sudo docker run -it jmar71n/freepbx bash root@46f45b8973c3:/# r...
Docker run, creates a new instance (para virtualised) environment from a given image. To log in to a given instance, you need to run docker exec but you need to execute docker exec with the id of the container you are looking to log into. This can be attained from the command: docker ps -a Then with the id attained, ...
How can I log into a running docker instance?
1,337,608,929,000
For example. [root@ip-10-0-7-225 ~]# I edited /etc/hosts but it didn't work.
As noted, the problem is the hostname. CentOS (unlike Debian) may get that information from /etc/sysconfig/network e.g., a line like HOSTNAME=myhostname.mydomainname Further reading: 28.1.21. /etc/sysconfig/network
How to change the part after root@
1,337,608,929,000
I currently have a few cloud instances and each of them has it's own URL (such as example.com) that is pointed at it through my registrar. However, I am curious what, if any changes I should make to their hostname (using the hostname) command to configure them properly. Just for fun, I have given them totally random n...
[...] own URL (such as example.com) that is pointed at it through my registrar. That's not what a (domain) registrar does. A domain registrar just acts as your proxy for registering your domain, its contact information, and its delegated DNS servers in the domain registry. After that, it's up to the DNS servers what...
Why do I even need to set my hostname or my domain name?
1,337,608,929,000
I'm testing a VPS provider, and recently created a virtual machine with a hostname testserver using an ubuntu template. This VPS provider reserves and bills resources by the month, so if you create a VM for a small job, it's sensible to keep it around in case you need another VM for some other job later. I came back ...
sudo uses the system resolver, configured by /etc/nsswitch.conf; in your case, host lookups were configured to use /etc/hosts, which had the previous hostname identified with the server's IP. To fix it, simply update /etc/hosts with the new hostname.
sudo: unable to resolve host "hostname"
1,337,608,929,000
Why is bash shell sometimes saying I'm at @localhost while other times it says I'm at @computer-5?
Some DHCP servers (and clients) are configured to assign a hostname just like an IP address. In these cases the computer's hostname does in fact change to e. g. computer-5 (until it gets a lease assigning a different name, or the lease is relinquished). localhost will still work for the loopback interface, but the D...
Am I @localhost or @computer-5?
1,337,608,929,000
I am developing a web page using Apache Web Server in my pc. When I want to open it in the browser I use the ip, for example: http://192.168.1.6/proyect My host is part of a local network (a laptop and mobile device). In both of them, I can open up the website using the url mentioned above. I would like to know if it...
To define a domain for more than just your own computer in one place, you must have some authoritative domain controller. On a home network, the thing providing the local and first-line of DNS (domain names) info is your router. Any device on your home network is a member of the domain being defined by the router (bec...
Setting a domain name in LAN
1,337,608,929,000
The problem is that I fail to SSH to a remote machine via its hostname, while using its IP works. The hostname returned by command hostname is: california_desert while the name returned by command nslookup $IP_address is: pcpp3238782. They did not match each other. I think that's why I cannot connect to remote machine...
The problem here is that the hostname and hosts files are only used for the computer they're on. In order for other computers to be able to use the hostname, it needs to be in the DNS zone for the domain. Think of it like this - you get a phone, and it has a phone number 555-5555. You now know that to call California_...
Fail to ssh to remote machine via hostname
1,337,608,929,000
1. Starting a shell process under a separate child UTS namespace sudo unshare -f --mount-proc -u /bin/bash 2. Change the hostname in this process hostnamectl set-hostname newhostname 3. Monitor the change from a different shell $ hostname newhostname Expected Result The process in the parent namespace to preserve i...
hostnamectl comes along the systemd environment and it doesn't execute the sethostname(2) system call. It asks systemd to do it, through the /run/dbus/system_bus_socket socket. As systemd didn't change namespace, it performs this in the initial namespace, changing the name of the old UTS namespace (the initial where i...
Why is the UTS namespace isolation not working?
1,609,942,831,000
Background I am creating several VirtualBox instances to use as Web development environments (Arch host/Debian guests), and I want them to share most files but have an additional drive for each machine, mounted at /mnt. This is more memory-efficient than simply cloning the entire disk, and allows me to install tools a...
No, it is not recommended. In general, you would have a number of filesystems that can be shared (some even read-only), but the root filesystem is not one of them. The system boot process uses this filesystem. In your case, I would share /usr an possibly /opt. You would keep separate per machine on the rootfs (sizes...
How can I use unique hostnames across VMs with a shared root filesystem? Is this method even recommended?
1,609,942,831,000
According to Debian's RPi3 image wiki, I should be able to ssh into a Raspberry-Pi, with just the hostname. I shared internet from my Debian laptop, WiFi to the a Raspberry-Pi over Ethernet, but the hostname never resolved. What kind of settings/configuration do either the client and server or the network need for LAN...
Enable Link-Local Multicast Name Resolution (LLMNR) on the RPi. Edit /etc/systemd/resolved.conf and set LLMNR=true. Enable and start the systemd service system-resolved: systemctl --now enable systemd-resolved. No DNS server is needed, but name resolution only works on the local net. Make sure there are no duplicate h...
Linux/Windows client resolve Linux hostname on LAN
1,609,942,831,000
A set of servers that I SSH into use a switch statement in the default .bashrc to make system-specific configurations: case "$HOSTNAME" in: systemA*|systemB|) # some local definitions here ;; systemC*|systemD|) # some local definitions here ;; *) echo "No bashrc defi...
You could do this: case "$HOSTNAME" in: systemA*|systemB) # some local definitions here ;; systemC*|systemD) # some local definitions here ;; *) if [ "$(uname)" = "Darwin" ]; then echo "I'm on a Mac!" else echo "No bashrc definiti...
Alternative to hostname for system-specific bashrc
1,609,942,831,000
I have installed CentOS7 in VMWare Workstation 12 player and I'm trying to use key-based SSH authentication. I have completed the process of passwordless SSH and it works fine but I have to start the SSHD service every time I open VMWare as it refuses to connect to port 22, which is the default and I haven't changed i...
In CentOS 7, to start a daemon on boot, one must run the command: sudo systemctl enable daemon.service In your case, you must run: sudo systemctl enable sshd.service For Fully Qualified Domain Name, you should add the following line to /etc/hosts in your host (not virtual machine) according to the ip address of the ...
How to keep sshd service running all the time and set permanent FQDN hostname in CentOS7?
1,609,942,831,000
I am attempting to use bash-completion for URLs of the form "proto://host". Without the ":", I see expected behavior, with the ":" present, the URL comes out "faulty". Bash completion has a function for hostnames, _known_hosts_real. It has a parameter -p PREFIX that I want to use. How to reproduce "wrong" behavior: Yo...
@Michael_Veers pointed out, that this is expected behavior (+1), so I should write my own function. But instead I wrote a patch for the standard _known_hosts_real into my bashrc, that enables additional options: -t Do not trim to left colon -S <suffix> Add custom suffix In .bashrc: . <(type _known_hosts_real | sed ...
How to specify protocol prefix containing ":" to bash-completion function _known_hosts_real
1,609,942,831,000
When i start apache service in my debian 7.8 with the command : root@debian:/home/debian# service apache2 start [....] Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName . ok In my /etc/hosts 127.0.0.1 localhost # The fol...
Edit /etc/apache2/conf.d/httpd.conf, add the line: ServerName localhost
Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
1,609,942,831,000
All mails suddenly stopped sending, here is the maillog: Jan 26 17:02:20 vm2745 sendmail[3544]: My unqualified host name (Centos) unknown; sleeping for retry Jan 26 17:03:20 vm2745 sendmail[3544]: unable to qualify my own domain name (Centos) -- using short name Jan 26 17:03:20 vm2745 sendmail[3544]: t0QG2KPA003544: ...
Removed Centos from hosts and added this line: mydomain.com.ip.address mydomain.com Now it works.
Sendmail stopped sending mails (unable to qualify my own domain name (Centos) -- using short name)
1,609,942,831,000
What if one host is defined in /etc/hosts like: 192.168.0.100 server and one is defined in ~/.ssh/config like: Host server HostName 192.168.0.101 and you ssh into server: ssh server. How would such a conflict be resolved? I guess one has higher priority than the other.
If you do ssh server the server part could be a real host name or some ssh internal "nickname". ssh first looks for some nickname in .ssh/config, if it finds a configuration there it will use this. If it does not find a configuration it assumes a real hostname and tries to resolve it via /etc/host and dns.
What will be prioritized in a conflict between ~/.ssh/config hostname and /etc/hosts?
1,609,942,831,000
I am using a macBook Pro I enter: new-host-2:~ Justin$ hostname And it returns: new-host-2.home Why is this when it says in setting/sharing my computers name is "Justin's macbook pro" and computers on my local network can access my computer at "Justins-MacBook-Pro.local" The tutorial I am reading says that the command...
MAC OS X maintains at least three different names for different usages (ComputerName, HostName and LocalHostName). You can set the command line hostname to a different value with this command: scutil --set HostName "justins"
Why when I enter the command "hostname" it returns something other than my computers name?
1,609,942,831,000
I'm trying to connect to several computers via their hostnames since they get their IP via DHCP. I can successfully ping the machines via ping host-01.local. ping, wget, avahi-resolve and even Firefox all send out the required mDNS packages, which I checked throug Wireshark (UDP on port 5353). However ssh doesn't seem...
For some reason I had the 32-bit version of ssh on my system. Installing the 64-bit version seems to have solved all of my problems. After looking through the strace of the command I noticed ssh had failed trying to load a bunch of libraries. This baffled me at first because most of these libraries are installed on my...
SSH is unable to resolve local domain names
1,609,942,831,000
I am looking to build a script that will log in to multiple servers using a host file and run uptime, hostname -I and hostname Script so far echo"" ; echo "hostname:" $(ssh $HOST hostname) ; echo "IP:" $(ssh $HOST hostname -I) ; echo "uptime" $(ssh $HOST uptime) ; echo"" ; What would be the best way to accomplish m...
Assuming you just want all output in the terminal: #!/bin/bash hosts_file=/path/to/file username=youruser while read -r host; do hostname=$(ssh "${username}@${host}" hostname) ip_addr=$(ssh "${username}@${host}" hostname -I) uptime=$(ssh "${username}@${host}" uptime) echo { echo "Hostname...
uptime Script help [closed]
1,609,942,831,000
I just set up my raspberry pi. It is working great and I can easily access it from my local Windows machine using SSH. I gave it a custom hostname. I can acces the pi with this hostname only when the samba server is running on the pi. When I stop it I can no longer use the custom hostname and have to use the IP. I was...
You can either setup a DNS server and add an entry for your Pi's hostname + IP to it. All the systems that need resolve this hostname will need to make use of this DNS server. Your other option is to add an entry in your system's hosts file with an entry that specifies the Pi's hostname + IP address. 1.2.3.4 pi-host ...
Create FQDN in LAN for Windows systems without samba
1,609,942,831,000
When changing the hostname to a random set of alphanumeric characters on a machine running Linux Mint(17.1 Rebecca, Cinnamon 64-bit) I encounter some problems. The following script changes the hostname to a random set of alphanumeric characters: #!/bin/bash ### BEGIN INIT INFO # Provides: randomhostname # Re...
You don't appear to be setting the hostname after rewriting /etc/hostname. This should do the trick, added after the two sed lines: hostname "$new" If you're using DHCP and this hasn't resolved the problem, take a look at I changed my hostname, why is my bash PS1 prompt unchanged to see if that's at all relevant to y...
Changing the hostname on a Linux Mint desktop to a random value at boot time
1,609,942,831,000
I set up my hostname to a number, where running hostname gives: 6592 But when I run ping 6592, I get: connect: Invalid argument I checked the related Wikipedia page, and it does say that such a hostname is allowed (IIUC). What am I missing?
What the RFC says is actually immaterial here. The RFC specifies what goes on at the DNS level, but that's moot if ping doesn't make a DNS query in the first place. When ping receives an all-numeric argument, it interprets it as an IP address. IPv4 addresses are technically 32-bit numbers. They are almost always writt...
What is a valid hostname label?
1,609,942,831,000
What is the most concise way to resolve a hostname to a local IP address in Arch Linux?
You can use either host or nslookup from bind-tools: $ host 172.217.19.195 195.19.217.172.in-addr.arpa domain name pointer fra02s21-in-f3.1e100.net. $ nslookup 172.217.19.195 Server: 192.168.2.1 Address: 192.168.2.1#53 Non-authoritative answer: 195.19.217.172.in-addr.arpa name = fra02s21-in-f3.1e100.net.
How can I resolve an IP address to a hostname in Arch Linux? [duplicate]
1,609,942,831,000
I know I can associate hostname with my IP address in /etc/hosts: 1.2.3.4 foo and then, for example in tcpdump output, I will see foo instead of my IP address (if -n was not used) Anyways, can I temporarily add such IP -> hostname mapping on the commandline, without actually editing the file? Lets suppose I connect...
The hostname resolution service of the C library (which is used by almost all software that needs hostname resolution) is controlled primarily by the hosts: line in the /etc/nsswitch.conf file. Each keyword on that line causes the corresponding libnss_*.so library to be loaded, and those libraries will ultimately hand...
associate IP with hostname without editing /etc/hosts
1,609,942,831,000
I puchased a domain, say fireworks.com, and I would like to call my server ubuntu-18-04. How am I expected to edit /etc/hosts? Is it possible to add multiple aliases as follows? 127.0.0.1 localhost 127.0.1.1 ubuntu-18-04.fireworks.com fireworks.com ubuntu-18-04 5.247.221.66 ubuntu-18-04.fireworks.com fireworks.co...
From man hosts: This manual page describes the format of the /etc/hosts file. This file is a simple text file that associates IP addresses with hostnames, one line per IP address. For each host a single line should be present with the following information: IP_address canonical_...
/etc/hosts and aliases
1,609,942,831,000
I am referencing the following question because it's similar but not the same: hostname -i returns strange result in linux On my CentOS 7 system, I get a strange IP address from "hostname -i" after I change my hostname, and I am trying to figure out why this is the case. I change the hostname with following command:...
Unlike the hostname -I command, which just lists all configured IP addresses on all network interfaces, the hostname -i command performs name resolution (see the hostname man page). Since your newly assigned hostname cannot be resolved using the /etc/hosts file, running hostname -i will cause your system's name resol...
Understanding why hostname -i returns strange IP address
1,609,942,831,000
I'm having an issue relating to host names and SSL signing. The certificate signing process works fine if my host name is puppet. With the IP of the puppet master server being set in /etc/hosts. I don't want to use the IP as it will likely change and I'll have to update /etc/hosts again. Instead I point directly to th...
Is there anyway to set a host to url? E.g. something like the following in /etc/hosts That is not a URL. Its a hostname. The point of the /etc/hosts file is that it provides an alternative to DNS for resolving hostnames to addresses. The files nameservice (the bit of code that sits between your application and the /...
Set a host name alias in /etc/hosts?
1,609,942,831,000
# hostname --help | grep ip -i, --ip-address addresses for the host name -I, --all-ip-addresses all addresses for the host According to the above, -i should output just one IP address, while -I should output all. In my case, it works the other way around. # hostname -i 127.0.1.1 123.123.123.123 # hostn...
The hostname(1) manpage describes these options in full, which should clarify the confusion: -i, --ip-address Display the network address(es) of the host name. Note that this works only if the host name can be resolved. Avoid using this option; use hostname --all-ip-addresses instead. -I, --all-ip-addresses Display a...
The hostname command outputs two IP addresses when one is expected
1,609,942,831,000
I have an issue where my customer used a different hostname naming convention than my company did, for the devices they purchased from us. Example: We named the devices Lenny1, so the FQDN is lenny1.whatever.com and user@Lenny1 is what is visible to users when they log in to the device. The customer used the name PC...
You can change that in the /etc/bashrc file. Please make a backup of this file in case you make any mistakes. Within the file, you will see this line: [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " \h is the hostname of the machine. Remove that and replace it with PCAP02. That line should then look like this: [ ...
Is it possible to display a different hostname, when a user logs in?
1,609,942,831,000
I have recently converted one of my main Linux servers into my router as well, and made my old router simply a switch and an access point. My one issue is that I am unable to automatically determine hostnames on my local network and add them to the DNS cache. If I need to switch back to DNSMasq for this, I'm willing t...
ISC dhcpd is capable of doing dynamic DNS updates in combination with BIND, but not without some configuration. The full information can be found in the dhcpd.conf man page; essentially, you should do something along the following lines: Run ddns-confgen. This generates some config blocks that you need to add to your...
Local hostname resolution with BIND and custom domain
1,609,942,831,000
I got this error during the installation of 2 packages. root@blackbox:~# apt-get install mpack ssmtp Reading package lists... Done Building dependency tree Reading state information... Done mpack is already the newest version. ssmtp is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 1 not u...
The problem is that the value entered in /etc/hostname doesn't match any entries in /etc/hosts. This causes the command hostname --fqdn to return an unresolvable hostname, which results in ssmtp not installing. Make sure you add your machine's hostname to /etc/hosts. Related bugs: https://bugs.launchpad.net/ubuntu/+s...
hostname: Name or service not known
1,609,942,831,000
Whenever i try to start a daemon service with the service name start I get the following error: /etc/sysconfig/network: line 3: HOSTNAME: command not found MySQL Daemon failed to start. Starting mysqld: [FAILED] I get the same error message for vsftpd when using the same co...
In Red Hat-based systems, most services which use networking (including MySQL) load the networking configuration into shell variables by sourcing /etc/sysconfig/network. This configuration file contains shell variable assignments similar to: NETWORKING="yes" NETWORKING_IPV6="no" HOSTNAME="www.example.com" GATEWAYDEV="...
service start: HOSTNAME: command not found
1,609,942,831,000
I need to use the a custom URL name which is accessible from all devices in a LAN. I know that it can be set in the /etc/hosts file 127.0.0.1 myname 127.0.1.1 system09-System-Product-Name # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6...
Localhost as its name says can only be accessed from your local system. If you need other users to access yout custom URL you need to map your system IP address with the name used and then add this entry on all your LAN workstations by editing theirs /etc/hosts files for example: 127.0.0.1 <custom_name> # this...
How to change the name of localhost to a custom name which is available to other users in LAN
1,609,942,831,000
I have a very basic question here. This thing is puzzling me a little bit. I have one Ubuntu machine which is running 12.04 and I am connecting to that machine from putty in my desktop (which is running windows). I started Netflix Exhibitor like this in that Ubuntu machine - cronusapp@phx5qa01c:/zook$ java -jar ./exh...
If your hostname doesn't resolve to the IP address ( you can check it by pinging your hostname) add an entry in the /etc/hosts file like below 10.108.24.132 phx5qa01c.stratus.phx.qa.host.com Update For windows machines hosts file is in c:\WINDOWS\system32\drivers\etc\hosts
URL with hostname doesn't work but it works with IP Address
1,375,318,850,000
I just registered a domain name and paid for hosting with CentOS and I found that I had to do the binding myself following the lengthy steps http://www.linux-sxs.org/internet_serving/bind9.html I was wondering, is there an easier way to do this binding? I thought by configuring the dns name in Apache should be enough,...
The steps they provide effectively set up caching name service: zone "." { type hint; file "root.hints"; }; Serve DNS for the 192.168.1.0/24 and 127.0.0.0/8 netblock reverse DNS zones: zone "0.0.127.in-addr.arpa" { type master; file "pz/127.0.0"; allow-update { none; }; }; and zone "1.168.192.in...
binding ip address to hostname
1,375,318,850,000
Below rsync works and helps copy remote directory to localhost /bin/rsync -rv myremoteuser@myremotehost:/tmp/Deployments/ /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremotehost/ Once i add -o StrictHostKeyChecking=no it fails with the below error: /bin/rsync -rv -o StrictHostKeyChecking=no myremoteuser@...
Rsync doesn't take ssh -o options on its command line. You have to put ssh options into an ssh command string you pass to rsync's -e option. Something like: /bin/rsync -rv -e 'ssh -o StrictHostKeyChecking=no' myremoteuser@myremotehost:/tmp/Deployments /web/playbooks/automation/getfiles/tmpfiles/4/E5EA787E/myremoteho...
rsync fails to work with -o StrictHostKeyChecking=no option
1,375,318,850,000
I have a simple backup script with this line to come up with a name for the backup: backup=$(/bin/date +'%Y-%m-%d_%H:%M_%S')_$(hostname).gz It works great when I run it under the root user. Unfortunately when I set it to run as a cronjob, the $(hostname) part is always empty and I don't get the hostname. Why isn't...
hostname doesn't seem to be in the PATH in your script. Either put /bin/hostname there, like you did for date, or set PATH to include /bin (inside the script or in the crontab).
$(hostname) doesn't work in cronjob [duplicate]
1,375,318,850,000
I have set up a local ssh server, which I like to access with this neat alias from my local network: ~/.ssh/config: Host myserver-local HostName 192.168.2.8 User iago-lito Port 22 In order to access it remotely, I have set up a no-ip account to access it via a dyndns IP resolution, which I like to access with this ne...
With a reasonably modern OpenSSH, you can run a shell command to select a Match block in ~/.ssh/config. Assuming you have a script am-on-home-network that returns 0 when executed on your home network and 1 when executed outside: Match Host myserver exec "am-on-home-network" HostName myserver User iago-lito Port 22 Ho...
Make hostname adapt to local/remote situation
1,375,318,850,000
We have a list of dns server IPs in /etc/resolv.conf. When doing nslookup for a particular scenario we would like to ingore the second entry below, so that naming resolution occurs via other 3 DNS server IPs. $ cat /etc/resolv.conf domain example.com nameserver 192.168.1.1 nameserver 10.10.10.1 nameserver 192.168.1.2 ...
One solution might be to temporarily change the order of the nameservers in /etc/resolv.conf . Another approach is to iterate through the nameservers and use them separately: while read IP do echo "Testing nameserver ${IP}" nslookup google.com "${IP}" done < <(grep nameserver /etc/resolv.conf| awk '(FNR != 2) ...
any option to ignore a dns server ip from /etc/resolv.conf when doing nslookup?
1,375,318,850,000
Ippsec does a lot of hackthebox boxes walkthroughs and in many of them he edits the /etc/hosts file. Sometimes he adds multiple hostnames to the same ip address and when he browses those hostnames he gets different webpages. Shouldn't all hostnames return the same webpage? Because my understanding(may be very wrong) i...
Web servers see the host header (IE the website name) that the browser is attempting to contact. The host header is sent regardless of how the IP was resolved. A single web server can host multiple sites on a single IP and thus uses the host header to determine which site/content to respond with.
Why adding hostnames to /etc/hosts entries change the website viewed
1,375,318,850,000
I have a fresh CentOS 7 install. During installation, I provided centa.home.local as hostname. Now one of the software needs to see "host -v centa" output to locate the server IP address on server. Unfortunately it can't find the IP address. [user1@centa ~]$ ifconfig | grep inet inet 192.168.101.128 netmask 2...
Since the host utility is performing DNS lookups, it's not using /etc/hosts. Meaning for it to succeed, the host has to be in a DNS server somewhere. Since the question is here, I'm assuming adding this DNS record to your DNS server (the one at 192.168.101.2) is not an option. Fortunately you can actually solve this r...
Making "host -v hostname" command work for CentOS 7
1,375,318,850,000
I recently installed CentOS 7 on a new hard drive with all default settings and when I enter: # hostname I get: SVP But "SVP" is neither in /etc/hostnames nor /etc/hosts configured. But I have the default hostname localhost.localdomain. SVP was the machine name of my old windows install but that hard drive wasn't...
I find it more likely that the name comes from the DNS. The machine gets the same IP address from DHCP (because the MAC address is still the same), and CentOS does a reverse lookup on the IP address and gets the old name back from the DNS server.
Does your hostname save on your NIC | centos 7?
1,375,318,850,000
My question is similar but opposite to to Telnetting the Local port not working but trying the ip working For me, telnet to the local port works but trying with IP does not work :( I am running pgbouncer on port 6432: $ telnet 192.x.x.x 6432 Trying 192.x.x.x... telnet: Unable to connect to remote host: Connection refu...
A quick Google shows that recommended safe configurations for pgbouncer often set up the listening port only on the loopback interface (localhost). Here is one example: [pgbouncer] listen_port = 5433 listen_addr = localhost auth_type = any logfile = pgbouncer.log pidfile = pgbouncer.pid The configuration documentatio...
Telnetting the local port working but trying with ip not working
1,375,318,850,000
I have an application that I want to be able to change the hostname in Linux. Currently doing so by running the hostname command. I don't want to set CAP_SYS_ADMIN either. I also don't want to edit /etc/hostname and reboot. Is there a capability that only just allows changing the hostname? If not what are my optio...
Setting the hostname in linux is done via the sethostname(2) syscall. And /bin/hostname is a bare wrapper around this syscall (and a few related syscalls). /etc/hostname is supposed to be read during the boot process by some script, who subsequently runs /bin/hostname to complish its job. CAP_SYS_ADMIN is one of linux...
Set hostname without root, and without CAP_SYS_ADMIN
1,375,318,850,000
Recently I installed apache2 on Raspbian and after end of installation I entered the following cmd and got two IP's. $ hostname -I 192.168.1.17 192.168.1.24 Of this, I have been using the IP ending in 17 from beginning. But I have never seen the one with 24. Can I use them both to access my RPi or each one present o...
hostname -I doesn't work here (openSUSE 13.2) but there is no problem with one host using several IP addresses. That is obviously possible by having several network adapters but you can have several addresses per interface (aliases) and even several interfaces per hardware NIC. The usual way to see the network configu...
Can a Linux system have two IP's Simultaneously?
1,375,318,850,000
I'm using a Debian on a RaspberryPi and the problem that I'm having is that I can't connect to the Internet. Every time I try I see a message that says "cannot resolve hostname". From the terminal, I tried: $ ping www.google.com unknown host google.com $ ping 8.8.8.8 network is unreachable output of 'ip addr list'...
Your /etc/network/interfaces is confused. There are several methods of assigning an IP address to the interface; you've specified dhcp which means to ask the DHCP server for an address. But then you went ahead and specified an address anyway. I think what you want is something like this auto lo iface lo inet loopback ...
Cannot resolve hostname
1,375,318,850,000
I am trying to type this comand but for some reason it takes the first and not the second version. I have entered both the host names in the host file, FYI. This command works (hostname zq13c1): mkcifsmnt -f /aix_bk5 -d AIX -h zq13c1 -c 'aix_user' -p 'Cognizant123' -u 214 -g 204 -t rw This command does not work (hos...
Quoting from this wiki article: The Internet standards (Request for Comments) for protocols mandate that component hostname labels may contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-'). The original specification of hostnames in RFC 952, ma...
AIX cifs hostname with underscore
1,375,318,850,000
Right now our team can connect to servers via SSH public key authentication. Each team member has a private key on his PC in ~/.ssh/ and the public key is on the server in the authorized_key file. A request has been made to authorize ssh connections to the servers only from the PCs given to each team member. Indeed ri...
The typical method to add restrictions to what is allowed when attempting to authenticate with particular private key, is via the relatively underused "options" field in a ~/.ssh/authorized_keys file on the server - specifically for your use-case would be the ability to configure/restrict from which hosts a particul...
Hostname problem in Host-based authentication when using SSH
1,375,318,850,000
I have several Raspberry Pi's named numerically (pi0, pi1, etc). They have static IP addresses, but I wanted a simple tool to check on them and make sure they were online even if they got the wrong IP (I've had some trouble in the past. Nothing recently, but it seemed like a good idea to make it foolproof regardless)....
As was briefly pointed out in the comments, ping is displaying that message to stderr, which you had not redirected. Do so with: ... ping -c1 pi$i.local > /dev/null 2>&1 ...
Suppress "Name or service not known" on ping
1,375,318,850,000
I set the hostname. # more /etc/hostname kafka01.ocff4.com The hostname is still as follows. hostname kafka01 I restart using the following command. systemctl restart systemd-hostnamed But still, hostname does not show the FQDN. hostname kafka01 Why did systemctl restart systemd-hostnamed not take affect? Is it ...
Take a look at your /etc/sysconfig/network file. If your hostname isn't present in the file, place the following line in it: hostname kafka01.ocff4.com You'll also have to "sudo hostname kafka01.ocff4.com" at the command line to make the change take affect immediatly, or restart to make the change take affect.
Why isn’t the hostname command getting the FQDN from /etc/hostname? [duplicate]
1,375,318,850,000
I have 2 Virtualbox VM's on which I have Ubuntu 15. The hostnames are: Machine 1: satya-VirtualBox Machine 2: sam1-VirtualBox Hosts file on machine 1- But I am able to ping machine 2 from 1 using hostname without any DNS server in my environment. How is the hostname getting resolved?
The Ubuntu machines are using Multicast DNS.
How a Virtualbox ubuntu VM able to resolve another ubuntu VM's hostname.?
1,375,318,850,000
I have a CentOS 7 install that is giving me some weird returns when I lookup the hostname of the localmachine. I am used to working with Windows and the hosts file (/etc/hosts in CentOS) so feel like I have this setup correct. I do have a few entries in the hosts file as I am running a group of virtual machines for a ...
swap the hosts in your /etc/hosts, the format should be long then short. good: 176.31.91.220 www.mikejonesey.co.uk mike bad: 176.31.91.220 mike www.mikejonesey.co.uk hostname will work off this, also I on epel systems i tend to change the domain in /etc/sysconfig/network to be just the hostname, then add the extra d...
CentOS 7 hostname netbios/fqdn output
1,375,318,850,000
how do I set the hostname, FQDN, in yast? I ran yast => network devices => network services => hostname/DNS: YaST2 - lan @ arrakis Network Settings ┌Global Options──Overview──Hostname/DNS──Routing──────────────────────────────────────...
In order for your changes to be visible in your current shell you need to terminate the current session and log back in. Your hostname will have changed to arakis. Explanation: a terminal session needs to be closed and re-opened for the profile to be re-read.
how do I set a hostname in yast?
1,375,318,850,000
I have a very strange problem with my hostname on Debian 7+. I've changed the hostname on my new server but for some reason it doesn't change in wierd places. Right now I get the old hostname when I login using SSH AND all my cron emails send the emails as [email protected]. /etc/hosts has the correct new hostname (ne...
Powering the server off and then powering it on again forced it to update the hostname. A regular reboot would probably do it as well in most cases.
Correct hostname doesn't change in entire system
1,375,318,850,000
I've seen some questions asking why xxx can't connect to MyMacName.local, which answer regarding Avahi as a requirement. I don't think I am in the same category as I can successfully connect to a Windows machine without needing to do anything on my Debian one. I am able to SSH into both Windows and Mac via IP address,...
When I had this problem it has been DNS based. Basically, when a DCHP client gets a IP from a "retail" router (or many other DNS/DHCP combined servers), they add an entry to the the DNS server so that ping mybox will work. Apple like to be just a little bit different about things, so I would not be surprised to find ...
Debian cannot SSH to OS X by hostname (Windows OK)
1,375,318,850,000
I changed the name of the hosts in /etc/hosts to IP.GOES.HERE newname Apache does recognize the new server name; but still, via ssh i get this on the ssh prompt: [root@oldname] Why? Where else do I need to change the server name? I'm using CentOS 6.3
On CentOS you set the system hostname in /etc/sysconfig/network. This setting change takes effect on reboot. To change the hostname on a running system without rebooting use the hostname command.
Changing the server name
1,375,318,850,000
I am trying to install nacl crypto on my system: % uname -a Linux (none) 2.6.39-ARCH #1 SMP PREEMPT Mon Jun 6 22:37:55 CEST 2011 x86_64 Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz GenuineIntel GNU/Linux But the build process didn't succeed: ~/nacl-20110221 % ./do ./do: line 9: hostname: command not found Did I forget s...
You don't have the hostname command. It just moved from net-tools to coreutils, so make sure you have the latest coreutils. Though there is some debate as to whether this is right, so it might change again. As of 2020, the package containing hostname is now inetutils.
nacl crypto installation on arch
1,667,594,652,000
I am trying to use part of the hostname output in Linux and use it in a file using sed. For example, I am using this command as hostname |tail -c 4 which shows me output as last 4 numbers and then use this output and substitute it with another text inside a file. Assuming part of the hostname command shows with tail -...
You could store the output of the first command in a variable $ var=$(hostname |tail -c 4) Once stored, you can then use it as the replacement with sed $ sed -i.bak "s/oldtext/$var/g" filename.txt
Using hostname output in linux with sed
1,667,594,652,000
I have cloned a KVM vm from one host to other host, I tried to rename the hostname and it's been renamed. But after reboot still it goes to old name. hostnamectl command output Static hostname: new_name Transient hostname: old_name Icon name: computer-vm Chassis: vm How do I find the root cause...
If you are getting Transient hostname: old_name and Static hostname: new_name. Then it's user space modification of hostname. Make sure there's no entry for Hostname in 2 below files 1. ~/.bash_profile - for respective user 2. /etc/rc.local
Hostname overrided after Reboot even after making entry in /etc/hostname
1,667,594,652,000
I would like to know what files must I edit in order to add a domain on a RHEL7 machine? Example: Hostname: Server1 Domain Name: qwer.tyu.iop Result: Server1.qwer.tyu.iop
I'd do this via the hostnamectl command. $ hostnamectl Static hostname: centos7 Icon name: computer-vm Chassis: vm Machine ID: 1ec1e304541e429e8876ba9b8942a14a Boot ID: 1fccc9bc187646549c942457b95ed299 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CP...
How to attach domain to RHEL7 using the shell?
1,667,594,652,000
I found something weird in my debian 9 config. I changed my hostname by editing /etc/hostname and rebooting from "myhost" to "myhost-hello". Since this modification connecting to the machine via it's ip (I don't use WINS or other functions like that at all) shows the server not reacheable. I said myself.. maybe it's s...
Seems that the error got solved editing also the /etc/hosts making the machine able to understand that the hostname must be searched locally instead being passed via the default gateway. So.. TL;DR: /etc/hosts edit the line myhost 127.0.0.1 for example to myhost-hello 127.0.0.1 ... that's all
Changing system hostname makes samba being unaccessible
1,667,594,652,000
I tried setting up a DNS Lookup on CentOS 7 (in a Virtual Box VM), which works for FQDN on the same virtual machine as the DNS. However when I try to resolve the short hostname, it fails. I have seen this working on some servers and wanted to learn how to set it up myself. Appreciate any help on this. Below are the co...
The problem is in your resolv.conf/DHCP configuration if resolv.conf is not static. You have got to add to the search directive of resolv.conf the domain eai.com When you try a DNS name lookup, the resolver libraries, if unsuccessful, try in turns to resolve the name adding the domains in the search directive until th...
CentOS7 unable to resolve nslookup for short hostname
1,667,594,652,000
I am trying to change the hostname of a CentOS6 system and somehow it keeps returning back to localhost. Basically, I am using: "hostname new_name" as a superuser, and it works. Then when I log in sometimes later, it forgets the new name and turns back to "localhost". Is there any suggestion what I did miss? I am usin...
Open /etc/sysconfig/network with a text editor like vim or nano. Specify the desired hostname on the line: HOSTNAME=ExamplePC
Hostname keeps turning back to localhost
1,667,594,652,000
I was following this tutorial to setup two virtual hosts in Centos 7. The issue is i am getting the following error while restarting the httpd. [userme@server ~]$ sudo systemctl restart httpd.service [sudo] password for userme: Job for httpd.service failed because the control process exited with error code. See "sy...
This looks like an issue with SELINUX that is enable be default on CentOS 7. Setting SELINUX=permissive and rebooting the server will log the issues to /var/log/audit/audit.log so that set the appropriate SELINUX setting can be set up to allow the SELINUX to protect the server. In addition setting up firewalld to allo...
Could not reliably determine the server's fully qualified domain name
1,667,594,652,000
Could you please explain the difference between: echo ${hostname}; and echo $(hostname); echo ${hostname}; - shows nothing, just an empty line. echo $(hostname); - shows information from /etc/hostname. tested on Ubuntu 22.04.1 and CentOS 7
${hostname} or $hostname is called parameter expansion, and here it gives the value of the shell variable hostname. It's probably unset, so you get the empty string which gets removed during word splitting since the expansion is not quoted. But you could of course define it, and Bash would automatically fill the upper...
echo ${hostname}; vs echo $(hostname);
1,667,594,652,000
I am getting the following error when trying to set the Primary node for DRBD. 'node1' not defined in your config (for this host). I know this is related to DNS/Hostname/Hosts and the config clusterdb.res. I know this because I originally got an error when trying to start clusterdb.res if node1 didn't resolve correct...
You're not using the drbdadm command correctly. It wants the resource name, where you're giving it a node name. Try this instead (from node1): drbdadm up clusterdb drbdadm primary --force clusterdb As a side note, DRBD expects the hostnames in its config to be the same as uname -n.
DRBD - 'node1' not defined in your config (for this host) - Error when setting Primary
1,667,594,652,000
I am quite new to Linux and I was wondering how to change the following when in terminal permanently. When I set up my computer I used a name that I now want to change: In terminal, the name I want to change would be of this form: TheNameIWantToChange@HostName ~ $ So my question is, what exactly is this name and how ...
If I understand correctly you'd like to change your user name. usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName usermod : modify an account -l : change the name -d : chnage the location (name) of the home directory -m : move the contents of the current home dir to the new one E.g. suppos...
How to change ThisName@HostName ~ $
1,667,594,652,000
"No news is good news", which, sticking with the normal convention should return 0. Why does hostname -h return 255, especially when, 255 by convention, is meant to mean "Exit status out of range"
"hostname -h" does not return 255 on my RHEL machine. it does return error 4 which make sense hostname -h Usage: hostname [-v] {hostname|-F file} set hostname (from file) ........ echo $? 4 If you take a look at hostname.c from net-utils you will clearly see that: static void usage(void) { fprintf(stderr, _...
Why does hostname -h return 255
1,667,594,652,000
I had set my hostname while installing linux as "ankit". i want to change it to "ankit.centos". I tried changing hostname in /etc/hosts, /etc/sysconfig/network and sysctl kernel.hostname=ankit.centos. Though the hostname is set correctly which I verified by typing hostname on terminal, but even after restarting the s...
The default PS1 prompt behavior is to display the hostname up to the first '.' as noted in this excerpt from the bash man page: PROMPTING When executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to c...
Changing hostname doesn't change the terminal name