0

I have created a new user "hadoopuser".

I have logged out and logged in as hadoopuser.

Now I am trying to edit hostname, but I am getting error.

hadoopuser@ubuntu:~$ sudo gedit /etc/hostname   
[sudo] password for hadoopuser:
hadoopuser is not in the sudoers file.  This incident will be reported.

Kindly suggest how to change my hostname. I am new to ubuntu

Zanna
  • 70,465
DevPerson
  • 1
  • 1
  • 2

1 Answers1

1

/etc/hostname is a global file defining the hostname of your complete PC not only for one user.

To edit it you have to have root permissions using sudo. Therefore the new user has to be in the sudoers file. Enable a new user for sudo running

sudo adduser <userName> sudo

as the user who already has sudo rights (so from the one where you created the new user ;) )

Note that you must also edit the file /etc/hosts so the hostname there matches that in /etc/hostname.

Zanna
  • 70,465
derHugo
  • 3,356
  • 5
  • 31
  • 51