This is probably a very stupid question but I've spent several hours today and yesterday now searching this forum and the web in general, but couldn't figure it out.
I want to define aliases for the root account. I tried creating a .profile, a .login and a .bashrc in the /root/ I also tried defining the in aliases /etc/profile. Everything is ignored. What am I missing? Can't believe that slitaz doesn't allow for this... When I source them it obviously works but when I exit the shell and su back in I it's not working anymore...
Standard stuff actually. Things like la for ls -a. But I also tried to put a line echo "this file was read at login" to see if the file is actually read. But it seems to be completely ignored. For the normal user everything works without problems.
slitaz-3.0 or cooking: Can't login to root from xterm(Login incorrect),have to use sudo su but alias doesn't work. Login for tux or another regular user works from xterm Adding alias to /root/.profile only works after login root from console(screen=text)or vt (ctrl-alt-F1->F6)
@mojo er... what? Do you have the sudo package installed and setup correctly? Are you doing su root <enter/return key> or are using just su <enter/return key>? Are you using the correct password? In SliTaz you can set both the root and user password to be different - in my case theirs the same.
@joe_2000 - try the following: 1. su to root 2. leafpad la 3. Write the following in leafpad and save: #!/bin/sh ls -a $1 4. chmod +x la 5. mv la /bin
and now you should have an la command that works like you'd expect - it uses a cheap bash script to get things to work. This will work with or without a path specified. You can use similar scripts to create aliases like this and they'll work instantly. Hope it helps
Hi Trixar! Thank you for your hint. Yes that would be an alternative but I tend to define many aliases :-)
However, while reading on something unrelated on the web today I came across something about the files being read upon login depending on whether or not the shell is started as a login shell using "su -" rather than only "su"
And yes - when I start the root shell using "su -s" the files /etc/profile and /root/.profile are read! So I could define an alias su='su -s' in my normal user .profile and that should do it. Is that "quick and dirty"? Am I missing anything? Introducing security risks or whatever? And to be honest it is still bothering me I don't seem to have properly understood the issue. The bash manpage also suggests a .bash_profile so I tried that as well - without success.
@Trixar_za My mistake was using login command :P When I'm logged in with slim as user tux joe_2000 login directions for root shell works in xterm. I have sudo installed with NOPASSWD, it skips the password prompt,goes straight to root prompt. tux@slitaz:~$sudo su - (enter) root@slitaz:~# My alias in /root/.profile works. When logged into xsession as root with slim and open xterm alias doesn't work. I have to exit which kills xterm and reopen xterm for alias to work.