Rainer Fritsch's picture

In a turnkey fileserver LXC I have as root a normal prompt via proxmox also via ssh, in which also TAB for file additions etc. works.

When I log in via SSH as a "my-user" (I did 'adduser my-user'), the prompt only shows $ and the keyboard does not work properly. Probably the bash has to be configured for this user.

I just don't understand why the settings for root are not taken over and how I can set this for "my-user". Thanks a lot.

Forum: 
Nicholas Barnes's picture

'adduser' should create .bashrc in the new user's home directory and logging in will use the system's default locale, so there should be no real difference between how root and a new user work in an SSH session.

I've just tried it and it works fine for me when I log in as the new user.

When you say the keyboard isn't working properly, what do you mean?

Jeremy Davis's picture

Firstly, the prompt showing '$' (I assume you mean instead of '#') is expected behavior with a limited user. Only root should show '#' at the prompt.

I'm also not 100% clear what you mean by "normal prompt via proxmox". Do you mean like in a NoVNC window? Or do you mean entering it via 'pct enter' from your PVE host?

Have you tested what happens if you log in as root, then change to the limited user? That might be an interesting test?

As for the keyboard not working as expected, that seems very strange to me. And it makes no sense to me that it would work as root but not as a limited user, especially if you are SSHing in from the same environment (the SSH server is configured to use the SSH client environment - i.e. your local SSH environment - not the server's). Obviously both NoVNC and pct are likely to be different experiences, albeit somewhat similar to SSH.

I guess it could be some bash conf issue, but the way it's set up is that when you create a new user (using adduser), all the defaults come from /etc/skel:

root@tkldev6 ~# tree -a /etc/skel/
/etc/skel/
|-- .bash_logout
|-- .bashrc
|-- .bashrc.d
|   |-- bash_completion
|   |-- bashmarks
|   |-- defaults
|   |-- git
|   |-- penv
|   `-- user-path
|-- .profile
|-- .profile.d
|   `-- .anchor
`-- .ssh

3 directories, 10 files

FWIW, we use this functionality to create additional users in some of the other appliances.

And it seems to work as expected when I manually create a new user:

root@tkldev6 ~# adduser test
Adding user `test' ...
Adding new group `test' (1000) ...
Adding new user `test' (1000) with group `test' ...
Creating home directory `/home/test' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for test
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] y
root@tkldev6 ~# tree -a /home/test/
/home/test/
|-- .bash_logout
|-- .bashrc
|-- .bashrc.d
|   |-- bash_completion
|   |-- bashmarks
|   |-- defaults
|   |-- git
|   |-- penv
|   `-- user-path
|-- .profile
|-- .profile.d
|   `-- .anchor
`-- .ssh

3 directories, 10 files

When I switch to my new user, all appears well:

root@tkldev6 ~# su - test
test@tkldev6 ~$ 

Tab completes works fine?!:

test@tkldev6 ~$ ca<Tab>
calc_tickadj  caller        capsh         captoinfo     case          cat           catchsegv     catman

If you can help me to reproduce the problem, I'm more than happy to have a red hot go at fixing it. But I don't even feel close to understanding this yet. Please try to give me some more information and details about the actual problems - the things that don't work.

Rainer Fritsch's picture

You see, if I press TAB the path will be expanded.

When I was logged in as user, TAB doesn't expand the path, some spaces are added. I don't see user@FS1 ~$ how I expected.

it doesn't matter if i log in to the proxmox console or via ssh as a user, same problem.

So I deleted the user and the group and created the same user again. Now it works fine. No idea what the problem was before. Thanks for your support.

 

Jeremy Davis's picture

Yes that is all very strange!

Regardless, I'm glad to hear that recreating the user resolved the issue. I have no idea why it didn't work the first time, but clearly it was some glitch. Hopefully it was some corner case issue which you won't encounter again.

Thanks for the original report regardless. And extra thanks for reporting back to confirm that it sort of resolved itself.

Good luck and please don't hesitate to drop in again if you have any further issues and/or questions.

Psilospiral's picture

Rainer - I often wondered why my TKLFS root login ran bash, but my user login did not.  This was the behavior I experienced after my install of File Server 16.1.  Pressing the cursor up arrow key yielded ^[[A instead of the previous command entered when logged in as a normal user.

After a little probing, I discovered that my cursor up arrow would not scroll through previous commands when logged in as a regular user because my user shell was set to /bin/sh in /etc/passwd !  Interestingly enough, root was set to /bin/bash  So I just made a quick backup of /etc/passwd and modified my user line with /bin/bash instead of /bin/sh ...  This made my life a lot easier!

 

Jeremy Davis's picture

Thanks for sharing. That's very interesting.

I've never hit that before and I can't reproduce it. Although I'm pretty sure I tested in a VM (rather than a container) so I wonder if that's the difference?

Regardless, thanks for posting your workaround.

Add new comment