MSYS2 on Windows 7 VM

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions MSYS2 on Windows 7 VM
# 1  
Old 06-12-2015
MSYS2 on Windows 7 VM

Hello All,

Hopefully I'm posting this in the correct place...

I just recently installed MSYS2 (*32-bit) on a Windows 7 VM I have running on my Linux Host. I have a basic question about User management on MSYS.

MSYS2 i686: Version 20150512

I'm guessing when MSYS gets installed it uses your Window's info, like username/etc to create your user in MSYS and to build your User's HOME dir (*i.e. /home/<win_username>)and stuff like that. Since My Window's User contains my first and last name, when MSYS installed it created my home dir as "/home/First Last", with the whitespace inbetween... This is starting to become a real nuisance. I could not find the file I would normally use to be able fix this, which is "/etc/passwd". So I'm kind of stumped on how I can resolve this.

I didn't want to just rename the HOME dir to something else because I figured that would break the env var HOME and also "~" (*i.e. tilde).

So basically what I want to do is change my Username and Group Name in MSYS, as well as change the Home directory after the username is changed.

Is this possible? Any thoughts or suggestions would be very much appreciated!

Thanks in Advance,
Matt
# 2  
Old 06-17-2015
Bump....


Update:
Not sure I did this correctly or if it's going to mess anything up later on down the road, but I made a slight workaround... Haven't actually changed the existing Username, which I want to do but after reading some stuff for Cygwin, which is what MSYS is built off of I believe, it said the User in Cygwin is directly linked to that of your Window's User. So any files/folders will also be owned by your Windows User, or something along those lines...

But anyway, since MSYS does not create a /etc/passwd file, I ran the command
Code:
/usr/bin/mkpasswd  >  /etc/passwd

which created the passwd file using all existing user information. Then I simply modified the HOME dir portion of my User's line in /etc/passwd to a 'first intial last name' format, like "/home/flastname".

Then I copied everything from the old HOME dir to the new one using these 2 commands. Needed both because the first cp did not copy hidden files...
Code:
# cp -R /home/First*/* /home/flastname/
# cp -R /home/First*/.* /home/flastname/

After I did all that and I opened a new MSYS terminal, I was automatically taken to the NEW home dir by default.

I would still love to be able to change the Username itself if at all possible, but still have not found any instructions on how to do so.

I did however read an interesting article on someone trying to do this with Cygwin and what they did was:
1st) They installed Cygwin completely.
2nd) After the installation and before opening Cygwin for the first time they said they opened "/etc/passwd" and found the line containing their default Window's User and changed the username to something without whitespace, like the first initial and lastname format.
3rd) They opened the Cygwin terminal for the first time and Ta-Da, the new username was used instead...

Does that sound like something I should try? Could something like that mess-up anything else? Maybe file permissions, or something along those lines...? I would just hate to have to re-download any packages I've installed or re-do any modifications I made to the system already

Or... Maybe there is a way to "trick" MSYS into thinking it's the first time I'm opening MSYS and I could try the above, any idea..?

Thanks,
Matt
# 3  
Old 06-22-2015
As it turns out if I just changed the Username in /etc/passwd (*column 1) it seems to have worked just fine. I believe MSYS uses the SID of the Windows user, which you can see in the 5th column of passwd, which is the GECOs column. MSYS uses this SID to create the UID of the user. So even if you change the username to something else it still keeps the same UID, which I believe will keep the same permissions of the Windows User.

Here is where you can find the commands to create "/etc/passwd" and "/etc/group" using mkpasswd/mkgroup, if passwd & group do not already exist:
https://cygwin.com/cygwin-ug-net/using-utils.html

*This link had a good explanation of the Windows SID and how MSYS uses it to create the UID:
https://cygwin.com/cygwin-ug-net/ntsec.html#id317355

This also contains some info that helped me out:
https://www.cygwin.com/ml/cygwin/2006-07/msg00784.html

Thanks,
Matt
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Can I replace the gcc, and along with all other binaries, in MSYS2 minGW64 with the MinGW64 Project

Can I replace the gcc, and along with all other binaries too, in MSYS2 minGW64 with ones by MinGW64 Project Can i safely replace the gcc, if asked, telling its version: gcc.exe (Rev2, Built by MSYS2 project) 6.2.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see... (1 Reply)
Discussion started by: abdulbadii
1 Replies

2. Windows & DOS: Issues & Discussions

UNIX for Advanced & Expert Users > I tried to build libtiff on MSYS2+minGW but found an interruption

When I tried to build libtiff on MSYS2+minGW and opened the MSYS2 shell, got error: $ ./configure configure: loading site script /etc/config.site checking build system type... Invalid configuration `x86_64-pc-msys': system `msys' not recognized configure: error: /bin/sh config/config.sub... (1 Reply)
Discussion started by: abdulbadii
1 Replies

3. Programming

[MSYS2/GCC-TDM] Compiler not finding headers in /usr/local/include

I hope it's okay to post this here. I'm working on Windows computer but using the Unix-like environment MSYS2 (https://sourceforge.net/projects/msys2). My problem is that I can't get the compiler to find headers located in /usr/local/include. I am trying to compile libpng which wants the header... (1 Reply)
Discussion started by: AntumDeluge
1 Replies
Login or Register to Ask a Question