function::ns_euid - Linux


Overview

function::ns_euid is a Perl function that retrieves the effective user ID (EUID) of the process in the current namespace.

Syntax

use namespace::clean;

ns_euid(NS::Requested | NS::Effective);

Parameters:

  • NS::Requested: Retrieve the EUID requested by the process.
  • NS::Effective: Retrieve the actual EUID in effect for the process.

Options/Flags

None.

Examples

Retrieve the requested EUID:

my $euid = ns_euid(NS::Requested);
print "Requested EUID: $euid\n";

Retrieve the effective EUID:

my $euid = ns_euid(NS::Effective);
print "Effective EUID: $euid\n";

Common Issues

Permission Denied Errors: Ensure that the caller has sufficient permissions to retrieve the namespace-related information.

Integration

Using with "chroot":

use namespace::clean;
chroot('/new/root');

my $euid_chroot = ns_euid(NS::Effective);
print "EUID in chroot: $euid_chroot\n";

Related Commands

  • setuid()
  • geteuid()
  • Linux namespaces