LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to change the name of my computer? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-the-name-of-my-computer-4175731559/)

Harve 12-05-2023 09:04 PM

How to change the name of my computer?
 
I recently bought this used computer that was already set up with Mint / Cinnamon and it is named "new-user" and I don't have the foggiest idea about how to rename it. Any ideas? TNX

computersavvy 12-05-2023 09:15 PM

The hostnamectl command can manage that. Use "man hostnamectl" or "hostnamectl -h" to see usage information.

If that command is not available then simply putting the new hostname into the /etc/hostname file will suffice as well.

jefro 12-05-2023 10:34 PM

https://linuxhint.com/change-hostname-linux-mint/

Wonder if it will ask about sudoers list?

Ysaveth 12-06-2023 03:12 AM

Quote:

Originally Posted by Harve (Post 6468671)
I recently bought this used computer that was already set up with Mint / Cinnamon and it is named "new-user" and I don't have the foggiest idea about how to rename it. Any ideas? TNX

Did you make it? If yes, please tell me how you did it.

yancek 12-06-2023 03:35 AM

Did you read posts 2 and 3? Post 2 gives a command to use to do the job and post 3 has a link to another site which explains 2 methods in detail. Read through it.

Harve 12-06-2023 11:35 AM

"Did you make it? If yes, please tell me how you did it."

No, I didn't make it. I used both methods but it only has the ability to change the text that's displayed to the right of the @ sign. I changed the hostname to 'Test' and the name transitioned from "new-use@new" to "new-user@test"

new-user@test:~$ sudo nano /etc/hostname
[sudo] password for new-user:

Oh, well. I guess I'll just be new-user for evermore.

Actually, I have a bigger fish to fry. When using Firefox, the video card stops sending data to the monitor, causing the monitor to go black and then going to sleep. The only remedy is to hold down the power button and force a shutdown of the computer. Upon re-start and opening Firefox again, the website that it was on when the problem occurred is opened again. (I exit out of that web page as a precautionary measure.) When I was trying to read the change hostnamectl page, I had to abort and restart the computer several times to get through it and it's exasperating. Only some sites seem to cause the problem and it seems to be associated with the video clips that advertisers embed in their pages. The "linuxhint" website is one of them.

I have no evidence but my best 'hunch' is that something in some videos is causing a conflict in the address of the video card. (???) I dunno.

I searched the linux boards and others have experienced this same problem with Mint too - but their remedial processes are too far over my head to comprehend what to do in an attempt to follow - so I've just been living with the grief of the problem. I am hoping that when I upgrade to the next major update that it will resolve itself - or - I might need to go back to CentOS or Rocky and see if they'll run on this machine.

Well, thanks all. I appreciate your time and effort in helping me. Respectfully and sincerely, Harve

computersavvy 12-06-2023 12:22 PM

Note that in post 2 I suggested you use 'man hostnamectl' to see what that command does and how to use it.
From that indicated man page it shows
Code:

NAME
      hostnamectl - Control the system hostname

SYNOPSIS

      hostnamectl [OPTIONS...] {COMMAND}

DESCRIPTION
      hostnamectl may be used to query and change the system hostname and related settings.

I won't do all the research for you because the info is available.
Saying "Oh, well. I guess I'll just be new-user for evermore." is the same as saying " I am too lazy to try anything to learn for myself. I want the commands given to me exactly as I should enter them" and really means you want your hand held because you are not willing to try.

Instead of saying " I can't" you should say "I will try thinking for myself and will succeed"

After all, we all learn by trying. Failure only means try a different way.

Harve 12-06-2023 12:47 PM

Quote:

Originally Posted by computersavvy (Post 6468799)
Note that in post 2 I suggested you use 'man hostnamectl' to see what that command does and how to use it.
From that indicated man page it shows
Code:

NAME
      hostnamectl - Control the system hostname

SYNOPSIS

      hostnamectl [OPTIONS...] {COMMAND}

DESCRIPTION
      hostnamectl may be used to query and change the system hostname and related settings.

I won't do all the research for you because the info is available.
Saying "Oh, well. I guess I'll just be new-user for evermore." is the same as saying " I am too lazy to try anything to learn for myself. I want the commands given to me exactly as I should enter them" and really means you want your hand held because you are not willing to try.

Instead of saying " I can't" you should say "I will try thinking for myself and will succeed"

After all, we all learn by trying. Failure only means try a different way.


Golly. Sorry I asked. Didn't mean to turn your crank.

scasey 12-06-2023 01:34 PM

As I read it, new-user is the username, not the hostname…because when the OP changed the hostname it changed the name after the @ in the prompt…
It appears that the seller set up a “default” user name of new-user. I think the solution is to simply create another user.

Harve, do you know how to do that?

jefro 12-06-2023 05:21 PM

new-user@test:~$ sudo nano /etc/hostname
[sudo] password for new-user:

OH heck. That is right scasey.

sundialsvcs 12-06-2023 06:21 PM

You can rename a user, and I suggest that you do.

Then, set up one "administrative user" who is a member of the wheel group, and then remove every other user from that group. This removes their ability to use "unrestricted 'sudo.'"

Another way to do it, of course, is to rename "new-user," which is now an administrator, and set up a new user for everyday use which is not. Then, use the administrator user only for "administrative things."

This is called the principle of least privilege. It is based on the simple fact that, while computers are terrible at knowing when to say "yes," they are very good at saying "no." If someone slips "rogue software" to your (non-privileged) user and asks it to do "sudo" behind your back, they will find that it cannot be done. Because you have voluntarily "limited your own privilege." If they slip into a telephone booth, they can't fly out of it wearing ugly blue tights – they can only make a phone call.

michaelk 12-06-2023 06:47 PM

I would be more inclined to just reinstall Mint or whatever distribution of your choice. That way you know exactly what / how it was installed and you can choose the username as well as hostname. Without knowing the specifications of the computer there is not much we can post (at least for me) about what might be causing the Firefox issue. Could be hardware, video driver etc.

Sometime ago I kind of remember a user that wanted to change the administrator name running Ubuntu and after that sudo did not work correctly. I don't know if that is still is the case today or if it works the same with Mint. Now days with debian based systems the sudo group has replaced the wheel group which maybe the case with Mint.

Jan K. 12-06-2023 07:47 PM

From a security point of view, surely it makes most sense with a fresh install, where you are the admin...?

jefro 12-06-2023 10:46 PM

And you get good practice. :)

The security part is a good point. Who knows what is on it?

JJJCR 12-07-2023 01:28 AM

Or have you tried this below, but I believe you will need a sudo password.

Quote:

sudo usermod -l new_username -s /bin/bash old_username
new_username << as it suggest, the name of the user account you want to have

old_username << old or current user account that will be changed

Haven't tried not sure if it will work...

or try editing: vi /etc/hostname


All times are GMT -5. The time now is 05:17 PM.