retaining alias after a reboot?

Status
Not open for further replies.

lleb

Dabbler
Joined
Nov 7, 2015
Messages
24
greetings, sorry new to the forum, hope this is in the correct place.

I understand that FreeNAS runs off of a flash drive, but there should be a way to edit .cshrc or .profile or .bashrc to retain custom alias after a reboot.

FreeNAS-9.3-STABLE-201511040813

is my current build

Thank you.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
You want to do this for the root user? I know this works for normal users but root user might be different.
 

lleb

Dabbler
Joined
Nov 7, 2015
Messages
24
both would be nice, but if its only for normal user that would go a long ways to saving some time of having to reload my aliases every time there is an update requiring a reboot.

currently any alias i place in the above listed files for either a normal user or root, are gone after a reboot.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Normal users store their configuration files in their home directory that lives on the pool. I hope freenas isn't modifying files that live in the pool. Where do you have the dotfiles stored?
 

lleb

Dabbler
Joined
Nov 7, 2015
Messages
24
Code:
Using username "user".
user@server's password:
Last login: Sun Nov  8 09:48:32 2015 from 192.168.2.150
FreeBSD 9.3-RELEASE-p28 (FREENAS.amd64) #0 r288272+a23e16d: Wed Nov  4 00:20:46                                                                                                        PST 2015

        FreeNAS (c) 2009-2015, The FreeNAS Development Team
        All rights reserved.
        FreeNAS is released under the modified BSD license.

        For more information, documentation, help or support, go here:
        http://freenas.org
Welcome to FreeNAS
[user@freenas ~]$ d
-bash: d: command not found
[user@freenas ~]$ ls -laF
total 119
drwxr-xr-x  3 user   wheel     13 Nov  7 13:42 ./
drwxrwxrwx  3 root  wheel      3 Oct 10 20:56 ../
-rw-------  1 user   wheel  12113 Nov  8 09:54 .bash_history
-rwxrwxrwx  1 root  wheel    898 Oct 10 20:56 .cshrc*
-rwxrwxrwx  1 root  wheel    186 Oct 10 20:56 .login*
-rwxrwxrwx  1 root  wheel     91 Oct 10 20:56 .login_conf*
-rwxrwxrwx  1 root  wheel    301 Oct 10 20:56 .mail_aliases*
-rwxrwxrwx  1 root  wheel    267 Oct 10 20:56 .mailrc*
-rwxrwxrwx  1 root  wheel    680 Oct 10 20:56 .profile*
-rwxrwxrwx  1 root  wheel    212 Oct 10 20:56 .rhosts*
-rwxrwxrwx  1 root  wheel    909 Oct 10 20:56 .shrc*
drwxrwxrwx  2 user   wheel      5 Oct 23 22:04 .ssh/
-rwxrwxrwx  1 root  wheel     59 Oct 10 21:03 z_local_aliases.sh*
[user@freenas ~]$ pwd
/mnt/Exports/home/user 


I hope code blocks work here.

I have also attempted modifying the same .bashrc, .profile, and .cshrc files in root:

they do not retain their aliases.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
I modified the bashrc and cshrc for root and it works fine, but some updates overwrite the files so you need to do the mod again.
 

lleb

Dabbler
Joined
Nov 7, 2015
Messages
24
Code:
# cat .bashrc
# $FreeBSD: stable/9/share/skel/dot.shrc 222932 2011-06-10 13:47:11Z jilles $
#
# .shrc - bourne shell startup file
#
# This file will be used if the shell is invoked for interactive use and
# the environment variable ENV is set to this file.
#
# see also sh(1), environ(7).
#


# file permissions: rwxr-xr-x
#
# umask 022

# Enable the builtin emacs(1) command line editor in sh(1),
# e.g. C-a -> beginning-of-line.
set -o emacs

# Uncomment this and comment the above to enable the builtin vi(1) command
# line editor in sh(1), e.g. ESC to go into visual mode.
# set -o vi


# some useful aliases
alias h='fc -l'
alias j=jobs
alias m=$PAGER
alias ll='ls -laFo'
alias l='ls -l'
alias g='egrep -i'
alias d='/bin/ls -laF'
alias dird='/bin/ls -laFp | grep /'


these are some of the lines i have to add after a reboot. they go poof, same for regular user.

These will remain until the reboot, then they are gone. As for the normal users I have to just run alias ... at the CLI as neither .cshrc, .profile, .shrc have any effect with their aliases:

Code:
$ cat .cshrc
# $FreeBSD$
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#

alias h         history 25
alias j         jobs -l
alias la        ls -aF
alias lf        ls -FA
alias ll        ls -lAF
alias d         ls -laF
alias dird      ls -laFp | grep /

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)

setenv  EDITOR  vi
setenv  PAGER   more
setenv  BLOCKSIZE       K

if ($?prompt) then
        # An interactive shell -- set some stuff up
        set prompt = "%N@%m:%~ %# "
        set promptchars = "%#"

        set filec
        set history = 1000
        set savehist = (1000 merge)
        set autolist = ambiguous
        # Use history to aid expansion
        set autoexpand
        set autorehash
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif


Code:
 cat .shrc
# $FreeBSD$
#
# .shrc - bourne shell startup file
#
# This file will be used if the shell is invoked for interactive use and
# the environment variable ENV is set to this file.
#
# see also sh(1), environ(7).
#


# file permissions: rwxr-xr-x
#
# umask 022

# Enable the builtin emacs(1) command line editor in sh(1),
# e.g. C-a -> beginning-of-line.
set -o emacs

# Uncomment this and comment the above to enable the builtin vi(1) command
# line editor in sh(1), e.g. ESC to go into visual mode.
# set -o vi


# some useful aliases
alias h='fc -l'
alias j=jobs
alias m=$PAGER
alias ll='ls -laFo'
alias l='ls -l'
alias g='egrep -i'
alias d='ls -laF'
alias dird='ls -laFp | grep /'

# # be paranoid
# alias cp='cp -ip'
# alias mv='mv -i'
# alias rm='rm -i'


# # set prompt: ``username@hostname$ ''
# PS1="`whoami`@`hostname | sed 's/\..*//'`"
# case `id -u` in
#       0) PS1="${PS1}# ";;
#       *) PS1="${PS1}$ ";;
# esac

# search path for cd(1)
# CDPATH=:$HOME


dont stick at all.
 
Last edited:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Why are all those files owned by root? They should be owned by the user they are for. That could be why it's not working.
 

lleb

Dabbler
Joined
Nov 7, 2015
Messages
24
no clue, never touched ownership permissions on the files.

created the user and ran with it.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I don't know that I have an answer for why this happens, but I have a few questions that might narrow it down...
  • Where is the user's home directory?
  • How did you create these files for the user?
  • After reboot, are the files still there, or do they disappear?
 

lleb

Dabbler
Joined
Nov 7, 2015
Messages
24
the path for the home directory for the user is in /mnt/Exports/home/user

At first I created the user via the CLI, but that was wrong so removed that user and recreated via the web interface.

After a reboot the files are present, but the information is back to default settings.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
If you created the users via the cli i doubt any of use can actually help you. The reason for this is we have no clue what you have messed up. Your permisison are wrong and no one can get it to behave the same as you. You should reinstall freenas on your usb and reconfigure it again by only using the webui. If you have to use the cli to set something up you are doing it wrong.
 
Status
Not open for further replies.
Top