nickola / web-console

:desktop_computer: Simple web-based shell in your browser (outdated)

Home Page:https://nickola.ru/projects/web-console

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$HOME_DIRECTORY not working

0x2F opened this issue · comments

I've setuped my
$HOME_DIRECTORY = '/home/nix/';

This is the usage example :

login: nix
password: *****
You are authenticated
nix@vpn.vagrant /home/nix/$ ls
Unable to change directory to current working directory, updating current directory
nix@vpn.vagrant /usr/share/nginx/html$

Make sure that directory $HOME_DIRECTORY (/home/nix/) exists and user running the Web Console have permissions for CD to that directory.
To identify user running the Web Console you can run id command in Web Console.
Also, try to run following commands in Web Console cd /home/nix/ and after that ls, what output you see?

I have the same problem. cd doesn't move the current directory

login: root
password: ******
You are authenticated
root@MLERMAN-LAP C:\UniServer\www\mlscript$ echo %cd%
C:\UniServer\usr\local\apache2
root@MLERMAN-LAP C:\UniServer\www\mlscript$ cd ..
root@MLERMAN-LAP C:\UniServer\www$ echo %cd%
C:\UniServer\usr\local\apache2

but it changes the string in the prompt correctly.

I found one issue. The command is not running in the context of the current directory

It needs this change

$cwd = getcwd();
$process = proc_open($command . ' 2>&1', $descriptors, $pipes, $cwd);

in the function execute_command

Now you can pass the home directory via the get variables.

$HOME_DIRECTORY = '';
if (isset($_GET["HOME_DIRECTORY"])) {
$HOME_DIRECTORY=$_GET["HOME_DIRECTORY"];
}