Skip to content

Instantly share code, notes, and snippets.

@hnts
Last active September 27, 2020 04:57
Show Gist options
  • Save hnts/7656345fdb59a4be5979d5338d0d893d to your computer and use it in GitHub Desktop.
Save hnts/7656345fdb59a4be5979d5338d0d893d to your computer and use it in GitHub Desktop.
Output UserID and Effective User ID
package main
import (
"fmt"
"os"
)
func main() {
fmt.Printf("User ID: %d\n", os.Getuid()) // 実ユーザID
fmt.Printf("Group ID: %d\n", os.Getgid())
fmt.Printf("Effective User ID: %d\n", os.Geteuid()) // 実効ユーザID
fmt.Printf("Effective Group ID: %d\n", os.Getegid())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment