lxd/endpoints/socket.go
func socketUnixSetOwnership(path string, group string) error {
	var gid int
	var err error

	if group != "" {
		gid, err = shared.GroupId(group)
		if err != nil {
			return fmt.Errorf("cannot get group ID of '%s': %v", group, err)
		}
	} else {
		gid = os.Getgid()
	}

	err = os.Chown(path, os.Getuid(), gid)
	if err != nil {
		return fmt.Errorf("cannot change ownership on local socket: %v", err)

	}

	return nil
}
func socketUnixSetOwnership(path string, group string) error {
	var gid int
	var err error

	if group != "" {
		gid, err = shared.GroupId(group)
		if err != nil {
			return fmt.Errorf("cannot get group ID of '%s': %v", group, err)
		}
	} else {
		gid = os.Getgid()
	}

	err = os.Chown(path, os.Getuid(), gid)
	if err != nil {
		return fmt.Errorf("cannot change ownership on local socket: %v", err)

	}

	return nil
}
func socketUnixSetOwnership ( path string , group string ) error { var gid int var err error if group != " " { gid , err = shared . GroupId ( group ) if err != nil { return fmt . Errorf ( " " , group , err ) } } else { gid = os . Getgid ( ) } err = os . Chown ( path , os . Getuid ( ) , gid ) if err != nil { return fmt . Errorf ( " " , err ) } return nil }
// Change the ownership of the given unix socket file,
Change the ownership of the given unix socket file