ruby - API to translate group name to group id (gid) -


file.chown takes an owner ID, a group id (GID), and a file name is. I want to use it to set the file's GID, but I have the group name is there anything in the standard library that I want to translate the group name into a GID Can i use

I is not more familiar with Ruby, but for this Linux syscall is straight group * Grigarmum (Const char * name) and it is obtained from the / etc / group file.

According to you, this functionality can be found in the etc. module:

  etc. .getgrnam ('users') - & gt; # & Lt; Struct string: group name = "user", passwd = "x", gid = 100, mem = ["meta", "root"] & gt;  

Comments