terminal problem with new user in linux - terminal

I have installed DB2 in my ubuntu 10.04 and meanwhile it has created 2 new users. and to run the db2 i have to switch to the new user created by the DB2.
But this new user's terminal has less features i.e. it donot automatically complete the directory or filename by hitting tabs, can't use up/down/left/right arrow keys. and not colorful like my actual terminal in my default user of ubuntu.
Please Help.
Thanks in advance:)

Change the users shell to /bin/bash, instead of /bin/sh.
# usermod -s /bin/bash YourDB2User
Since some time now, both Debian and Ubuntu uses dash to provide /bin/sh, which doesn't have all the features like bash, but provides a more accurate interpretation of the bourne shell, from what I understand.

this new users should not do anything except executing the command/demon, so they dont need a terminal. they should have as little rights as possible - thats part of the trick. if you want to execute a command as this user, try sudo -u(newuser) command

Related

JupyterLab Terminal - allow only basic commands, customize behavior for a few

We are running JupyterLab Terminal inside a docker container and making it available for every user. User can run any command as of now. what we need is to customize Jupyter behavior on certain commands e.g. if user types rm -rf * (*nix command) then Jupyter should prompt This is not allowed or something similar.
Thanks in advance for any help.
This is not possible via Jupyter, the terminal is "just" a small wrapper that interact with a real terminal. This is exactly the same as giving users access via SSH.
You want to change the user default shell, and have opt-in commands.
Though be aware that this will just be a façade, if user have access to a Jupyter kernel, especially Python ones, they can already run system commands (by preceding the line with a bang), and/or use ctypes to directly call system functions.

Need to update shell in PyCharm to zsh

Started taking the 'Programming for everyone' course on Coursera to learn python. Ive downloaded 2 text editors. Atom and Pycharm. When I open the terminal both say, "The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh."
Please understand I'm totally new. This is the first time I've ever used a text editor or terminal so don't know where to run this or how to straighten this out. Im using a 2015 MacBook Pro running 10.15.7Image is screenshot of editor and terminal in pycahrm im in.
Yeah, it sucks. I had the same problem with Pycharm, but this solution worked for me.
1- Change zsh to bash
$ /bin/bash
2 - Get the commands back like (cd, ls, clear ...)
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
3 - Get the profile back
. /etc/profile
After that your porfile will look like this "username:" instead of this "%n#%m %1~ %#"
One more thing, if you using mac, open your terminal and check preference. In the preferences go to General -> Shells open with -> if it is Default Login shell which means you are using zsh, you should change to Command (complete path): and add /bin/bash in the space below so that your default change to bash.
I hope it was useful for you, and for the people looking for answers. Cause, I wasted an hour looking for solution that JetBrain Pycharm and Apple couldn't provide.

Default shell program in emacs

How can I determine the default shell program in Emacs?
On an Ubuntu machine when I go to term mod (M-x term) or Emerge, it tries to run /bin/bash
On anther machine, Emacs tries to run /bin/false and I want to fix this problem.
Could you please help me to fix this issue?
That looks like a user configuration issue - Emacs is most likely using the default shell and it's a common way to prevent users from getting shell access by setting the shell to /bin/false or /bin/nologin (or variations thereof).
The remedy is to get the sysadmin to give you shell access as in a proper shell configured for your user account instead of /bin/false.
Thanks to Steve Howard, The problem can be solved by changing SHELL to /bin/bash

/bin/dash cannot find hostname

I have newly installed a remastered ubuntu 12.10. after installation I ran a script to make a standard user and do some other works. now when I log into the new standard user and open terminal, it only shows a $ mark and doesnt show username#hostname$.
it can return whoami but doesnt return anything for echo $HOSTNAME
the interesting thing is when I run bash, everything is ok, but when I run dash(which is default in ubuntu) I see the problem.
I've tried dpkg-reconfigure dash but nothing changed.
can anyone guess what is happened to my system!
thank you in advance.
I suggest to use bash instead of dash since the former is far better for interactive use.
The shell for the new user is probably set to /bin/dash, you just have to create the new user specifing the shell you want using the --shell option for the adduser command.
To change the shell for an alredy created user you can use the command chsh.

In Bash, how can I tell if I am currently in a terminal

I want to create my own personal logfile that logs not only when I log in and out, but also when I lock/unlock my screen. Kindof like /var/log/wtmp on steroids.
To do this, I decided to run a script when I log into Ubuntu that runs in the background until I quit. My plan to do this is to add the script to .bashrc, using ./startlogging.sh & and in the script I will use trap to catch signals. That's great, except .bashrc gets run every time I open a new terminal, which is not what I want for the logger.
Is there a way to tell in Bash that the current login is a gnome login? Alternatively, is there some sort of .gnomerc I can use to run my script?
Edit: Here is my script:
Edit 2: Removed the script, since it's not related to the question. I will repost my other question, rather than repurpose this one.
Are you looking for a way to detect what type of terminal it is?
Try:
echo $TERM
From Wikipedia:
TERM (Unix-like) - specifies the type of computer terminal or terminal
emulator being used (e.g., vt100 or dumb).
See also: List of Terminal Emulators
for bash use : ~/.bash_logout
that will get executed when you logout, which sounds like what you are trying to do.
Well, for just bash, what you want are .bash_login/.bash_logout in your home directory (rather than .bashrc) These are run whenever a LOGIN shell starts/finishes, which happens any time you log in to a shell (on a tty or console, or via ssh or other network login). These are NOT run for bash processes created to run in terminal windows that you create (as those are not login shells) so won't get run any time you open a new terminal.
The problem is that if you log in with some mechanism that does not involve a terminal (such as gdm running on the console to start a gnome or kde or unity session), then there's no login shell so .bash_login/logout never get run. For that case, the easiest is probably to put something in your .xsessionrc, which will get run every time you start an X session (which happens for any of those GUI environments, regardless of which one you run). Unfortunately, there's no standard script that runs when an X session finishes.

Resources