ghantoos / lshell

lshell is a shell coded in Python, that lets you restrict a user's environment to limited sets of commands, choose to enable/disable any command over SSH (e.g. SCP, SFTP, rsync, etc.), log user's commands, implement timing restriction, and more.
GNU General Public License v3.0
436 stars 112 forks source link

custom prompt options #114

Closed lmarkov closed 8 years ago

lmarkov commented 8 years ago

Is there a way to configure more detailed prompt information? Using this options:

##  configure your promt using %u or %h (default: username)
prompt          : "%u@%h"

##  set sort prompt current directory update (default: 0)
prompt_short    : 1

the path looks like:

root@myserver: public_html$ pwd
/home/myuser/public_html

I want to see the information from pwd for example:

root@myserver: /home/myuser/public_html$ 

Is it possible?

ghantoos commented 8 years ago

The reference point is the home directory of the user. It is not possible to do this with the current code. I will set this as wishlist. If you have time to propose a patch. ;)

lmarkov commented 8 years ago

I added this:

#in
def updateprompt(self, path):

# new condition
elif self.conf['prompt_short'] == 2:
            self.prompt = '%s:%s:$ ' % (self.promptbase, os.getcwd())

In my configuration file I use:

set sort prompt current directory update (default: 0)

 prompt_short    : 2

In my configuration this works for me.

ghantoos commented 8 years ago

Thanks! I'll look into this.

lmarkov commented 8 years ago

Hello,

Is there option to see the path for symlink instead the real path. For example I have symlink in directory /home/myuser

access-logs -> /usr/local/apache/domlogs/myuser

and when I enter with:

cd access-logs

the result in pwd is

/usr/local/apache/domlogs/jadoreb

instead:

/home/myuser/access-logs

Can you suggest a solution?

ghantoos commented 8 years ago

@lmarkov I have opened a new issue here: https://github.com/ghantoos/lshell/issues/134

I will need to look into this bug, as what you are asking is currently not possible to achieve.

Thanks for the report!