Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
File::Stat#setuid?
stat.setuid? → true or false
file.c
View on GitHub ↗
static VALUE
rb_stat_suid(VALUE obj)
{
#ifdef S_ISUID
if (get_stat(obj)->st_mode & S_ISUID) return Qtrue;
#endif
return Qfalse;
}
Returns true if stat has the set-user-id permission bit set, false if it doesn’t or if the operating system doesn’t support this feature.
Example
File.stat("/bin/su").setuid? #=> true