group

group() Class Public methods Provides a convenient Ruby iterator which executes a block for each entry in the /etc/group file. The code block is passed an Group struct. See ::getgrent above for details. Example: require 'etc' Etc.group {|g| puts g.name + ": " + g.mem.join(', ') }

getpwuid

getpwuid(uid) â Passwd Class Public methods Returns the /etc/passwd information for the user with the given integer uid. The information is returned as a Passwd struct. If uid is omitted, the value from Passwd[:uid] is returned instead. See the unix manpage for getpwuid(3) for more detail. Example: Etc.getpwuid(0) #=> #<struct Struct::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">

getpwnam

getpwnam(name) â Passwd Class Public methods Returns the /etc/passwd information for the user with specified login name. The information is returned as a Passwd struct. See the unix manpage for getpwnam(3) for more detail. Example: Etc.getpwnam('root') #=> #<struct Struct::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">

getpwent

getpwent() Class Public methods Returns an entry from the /etc/passwd file. The first time it is called it opens the file and returns the first entry; each successive call returns the next entry, or nil if the end of the file has been reached. To close the file when processing is complete, call ::endpwent. Each entry is returned as a Passwd struct.

getlogin

getlogin â String Class Public methods Returns the short user name of the currently logged in user. Unfortunately, it is often rather easy to fool ::getlogin. Avoid ::getlogin for security-related purposes. If ::getlogin fails, try ::getpwuid. See the unix manpage for getpwuid(3) for more detail. e.g. Etc.getlogin -> 'guest'

getgrnam

getgrnam(name) â Group Class Public methods Returns information about the group with specified name, as found in /etc/group. The information is returned as a Group struct. See the unix manpage for getgrnam(3) for more detail. Example: Etc.getgrnam('users') #=> #<struct Struct::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>

getgrgid

getgrgid(group_id) â Group Class Public methods Returns information about the group with specified integer group_id, as found in /etc/group. The information is returned as a Group struct. See the unix manpage for getgrgid(3) for more detail. Example: Etc.getgrgid(100) #=> #<struct Struct::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>

getgrent

getgrent() Class Public methods Returns an entry from the /etc/group file. The first time it is called it opens the file and returns the first entry; each successive call returns the next entry, or nil if the end of the file has been reached. To close the file when processing is complete, call ::endgrent. Each entry is returned as a Group struct

endpwent

endpwent() Class Public methods Ends the process of scanning through the /etc/passwd file begun with ::getpwent, and closes the file.

endgrent

endgrent() Class Public methods Ends the process of scanning through the /etc/group file begun by ::getgrent, and closes the file.