Skip to content

Commit 1ac5be9

Browse files
committed
Source .bashrc from the ~/.profile file
1 parent 5ceb256 commit 1ac5be9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

server/plugins-available/shelluser_base_plugin.inc.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ function insert($event_name, $data) {
181181
$app->system->chmod($homedir.'/.profile', 0644);
182182
$app->system->chown($homedir.'/.profile', $data['new']['username']);
183183
$app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']);
184+
$profile_content = "
185+
if [ -d ~/.bashrc ]
186+
then
187+
. ~/.bashrc
188+
fi
189+
";
190+
$app->system->file_put_contents($homedir.'/.profile', $profile_content);
184191

185192
//* Create .bashrc.d directory
186193
if(!is_dir($homedir.'/.bashrc.d')){
@@ -326,6 +333,13 @@ function update($event_name, $data) {
326333
$app->system->chmod($homedir.'/.profile', 0644);
327334
$app->system->chown($homedir.'/.profile', $data['new']['puser']);
328335
$app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']);
336+
$profile_content = "
337+
if [ -d ~/.bashrc ]
338+
then
339+
. ~/.bashrc
340+
fi
341+
";
342+
$app->system->file_put_contents(($data['new']['dir']).'/.profile', $profile_content);
329343
}
330344

331345
//* Create .bashrc.d directory

0 commit comments

Comments
 (0)