update to make passwd file toggle-able
This commit is contained in:
parent
cc0dca4c84
commit
752b779d1f
|
@ -169,7 +169,9 @@ type SystemConfiguration struct {
|
|||
Uid int `yaml:"uid"`
|
||||
Gid int `yaml:"gid"`
|
||||
|
||||
Login bool `yaml:"login"`
|
||||
// Passwd controls weather a passwd file is mounted in the container
|
||||
// at /etc/passwd to resolve missing user issues
|
||||
Passwd bool `json:"mount_passwd" yaml:"mount_passwd" default:"true"`
|
||||
} `yaml:"user"`
|
||||
|
||||
// The amount of time in seconds that can elapse before a server's disk space calculation is
|
||||
|
@ -532,13 +534,8 @@ func ConfigureDirectories() error {
|
|||
if passwd, err := os.Create("/etc/pterodactyl/passwd"); err != nil {
|
||||
return err
|
||||
} else {
|
||||
shell := "/usr/sbin/nologin"
|
||||
if _config.System.User.Login {
|
||||
shell = "/bin/sh"
|
||||
}
|
||||
|
||||
// the WriteFile method returns an error if unsuccessful
|
||||
err := os.WriteFile(passwd.Name(), []byte(fmt.Sprintf("container:x:%d:%d::/home/container:%s", _config.System.User.Uid, _config.System.User.Gid, shell)), 0777)
|
||||
err := os.WriteFile(passwd.Name(), []byte(fmt.Sprintf("container:x:%d:%d::/home/container:/usr/sbin/nologin", _config.System.User.Uid, _config.System.User.Gid)), 0755)
|
||||
// handle this error
|
||||
if err != nil {
|
||||
// print it out
|
||||
|
|
|
@ -27,12 +27,18 @@ func (s *Server) Mounts() []environment.Mount {
|
|||
Source: s.Filesystem().Path(),
|
||||
ReadOnly: false,
|
||||
},
|
||||
{
|
||||
}
|
||||
|
||||
// Mount passwd file if set to true
|
||||
if config.Get().System.User.Passwd {
|
||||
passwdMount := environment.Mount{
|
||||
Default: true,
|
||||
Target: "/etc/passwd",
|
||||
Source: "/etc/pterodactyl/passwd",
|
||||
ReadOnly: true,
|
||||
},
|
||||
}
|
||||
|
||||
m = append(m, passwdMount)
|
||||
}
|
||||
|
||||
// Also include any of this server's custom mounts when returning them.
|
||||
|
|
Loading…
Reference in New Issue
Block a user