update to make passwd file path configurable

This commit is contained in:
Michael (Parker) Parker 2023-12-18 14:32:40 -05:00
parent 178fc54332
commit e5c8f50184
2 changed files with 5 additions and 4 deletions

View File

@ -171,7 +171,8 @@ type SystemConfiguration struct {
// 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"`
Passwd bool `json:"mount_passwd" yaml:"mount_passwd" default:"true"`
PasswdFile string `json:"passwd_file" yaml:"passwd_file" default:"/etc/pterodactyl/passwd"`
} `yaml:"user"`
// The amount of time in seconds that can elapse before a server's disk space calculation is
@ -530,8 +531,8 @@ func ConfigureDirectories() error {
return err
}
log.WithField("filepath", "/etc/pterodactyl/passwd").Debug("ensuring passwd file exists")
if passwd, err := os.Create("/etc/pterodactyl/passwd"); err != nil {
log.WithField("filepath", _config.System.User.PasswdFile).Debug("ensuring passwd file exists")
if passwd, err := os.Create(_config.System.User.PasswdFile); err != nil {
return err
} else {
// the WriteFile method returns an error if unsuccessful

View File

@ -34,7 +34,7 @@ func (s *Server) Mounts() []environment.Mount {
passwdMount := environment.Mount{
Default: true,
Target: "/etc/passwd",
Source: "/etc/pterodactyl/passwd",
Source: config.Get().System.User.PasswdFile,
ReadOnly: true,
}