reparatie bash
Last Updated: Feb 08 2019 15:43, Started by
NHT
, Feb 08 2019 13:26
·
0
#1
Posted 08 February 2019 - 13:26
Daca are cineva timp, il rog sa lamureasca un incepator asupra configurarii bash_profile.
M-am jucat cu permisiunile avansate chmod u+s ... asupra bash-ului si acum nu pot sa-l mai fac la loc. Acum am: [root@Tester etc]# echo $PS1 [\u@\h \W]\$ [root@Tester etc]# exit exit bash-4.2$ whoami alice2 bash-4.2$ echo $PS1 \s-\v\$ Vreau ca in userul alice2 sa vad din nou CLi-ul de tipul [\u@\h \W]\$ daca declar $PS1='[\u@\h \W]\$ ' merge pana la primul exit, apoi reapare forma fara user (\s-\v\$) am incercat sa modific .bash_profile in alice2~ doar ca nu il citeste: [root@Tester etc]# cat /home/alice2/.bash_profile # .bash_profile # Get the aliases and functions #if [ -f ~/.bashrc ]; then # . ~/.bashrc $PS1="[\d \t \u@\h:\w ] $ " fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH export PATH=/usr/local/bin:$PATH .bashrc din profilul curent (alice2): [root@Tester etc]# cat /home/alice2/.bashrc # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # Uncomment the following line if you don't like systemctl's auto-paging feature: # export SYSTEMD_PAGER= # User specific aliases and functions ma indreapta catre /etc/bashrc care arata asa: [root@Tester etc]# cat bashrc # /etc/bashrc # System wide functions and aliases # Environment stuff goes in /etc/profile # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. # are we an interactive shell? if [ "$PS1" ]; then if [ -z "$PROMPT_COMMAND" ]; then case $TERM in xterm*|vte*) if [ -e /etc/sysconfig/bash-prompt-xterm ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then PROMPT_COMMAND="__vte_prompt_command" else PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' fi ;; screen*) if [ -e /etc/sysconfig/bash-prompt-screen ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen else PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' fi ;; *) [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default ;; esac fi # Turn on parallel history shopt -s histappend history -a # Turn on checkwinsize shopt -s checkwinsize [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " # You might want to have e.g. tty in prompt (e.g. more virtual machines) # and console windows # If you want to do so, just add e.g. # if [ "$PS1" ]; then # PS1="[\u@\h:\l \W]\\$ " # fi # to your custom modification shell script in /etc/profile.d/ directory fi if ! shopt -q login_shell ; then # We're not a login shell # Need to redefine pathmunge, it get's undefined at the end of /etc/profile pathmunge () { case ":${PATH}:" in *:"$1":*) ;; *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi esac } # By default, we want umask to get set. This sets it for non-login shell. # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then umask 002 else umask 022 fi SHELL=/bin/bash # Only display echos from profile.d scripts if we are no login shell # and interactive - otherwise just process them to set envvars for i in /etc/profile.d/*.sh; do if [ -r "$i" ]; then if [ "$PS1" ]; then . "$i" else . "$i" >/dev/null fi fi done unset i unset -f pathmunge fi # vim:ts=4:sw=4 nu vreau sa incep sa modific pe aici ca inca nu pricep tot. daca are cineva timp sa ma lumineze, pls help. am incercat sa creez un user nou si bash lui arata tot de tipul \s-\v\$ am incercat si yum reinstall -y bash, la fel. probabil deci trebuie facuta o modificare in /etc/bashrc si as dori asistenta inainte sa reinstalez cu totul |
#2
Posted 08 February 2019 - 13:36
ls -lash ~/.bash*Si pune output-ul aici. Sau: find /home/alice2/ -type d -exec chmod u+rwx '{}' \; find /home/alice2/ -type f -exec chmod u+rw '{}' \; |
#3
Posted 08 February 2019 - 13:38
multumesc pentru raspuns kagaroth
[root@Tester etc]# ls -lash ~/.bash* 8.0K -rw-------. 1 root root 6.4K Feb 8 13:01 /root/.bash_history 4.0K -rw-r--r--. 1 root root 18 Dec 29 2013 /root/.bash_logout 4.0K -rw-r--r--. 1 root root 176 Dec 29 2013 /root/.bash_profile 4.0K -rw-r--r--. 1 root root 176 Dec 29 2013 /root/.bashrc nu e nimic cu S sau pt alice2 bash-4.2$ ls -lash ~/.bash* 4.0K -rw-------. 1 alice2 alice2 1.5K Feb 8 11:52 /home/alice2/.bash_history 4.0K -rw-r--r--. 1 alice2 alice2 18 Oct 30 19:07 /home/alice2/.bash_logout 4.0K -rw-r--r--. 1 alice2 alice2 256 Feb 8 13:01 /home/alice2/.bash_profile 4.0K -rw-r--r--. 1 alice2 alice2 231 Oct 30 19:07 /home/alice2/.bashrc [root@Tester etc]# find /home/alice2/ -type d -exec chmod u+rwx '{}' \; [root@Tester etc]# find /home/alice2/ -type f -exec chmod u+rw '{}' \; [root@Tester etc]# ieri am facut pozna, daca cauti ceva legat de timp Edited by NHT, 08 February 2019 - 13:51. |
#4
Posted 08 February 2019 - 14:54
Ma interesa sa vad ce permisiuni ai pe fisiere. Vezi pe /home/alice2 ce permisiuni ai. Promptul ala, bash-4.2 apare cand esti user alice2? Asa pare din ce ai postat. Intra ca user alice2 si da comanda(zile) whoami si id si posteaza aici rezultatele. Incearca si comanda de mai jos pe care o dai ca user root:
chown -R alice2:alice2 /home/alice2Ah ca si user alice2 da comanda: echo $PS1In ~/.bashrc poti incerca: export PS1="[\u@\h:\l \W]\\$ "La fel si in ~/.bash_profile Edited by MembruAnonim, 08 February 2019 - 14:57. |
#5
Posted 08 February 2019 - 15:43
da, asa e, forma scurta aparea doar in userul alice2 (precum si la adaugarea de useri noi)
owneri erau toti cu permisiunile implicite fara sticky bits sau permisiuni speciale. am mers cu export PS1="[\u@\h:\l \W]\\$ " in ~/.bashrc si ~/.bash_profile multumesc! |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users