DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-07-18 06:02:21

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Custom user login environments (ssh) - How ?

I have been looking at setting up the login environment for root so I have some utilities / alias's etc at hand when I ssh to the DNS-323.

The config files I setup vanish on reboot which leads me to believe the user home areas are loaded in to a ramdisk rather than being created as areas on the HD_a2 mount.

I had modified the system profile file (ffp/etc/profile IIRC) to copy the login setup files to the root home area (can't recall the default login shell but .cshrc .profile .kshrc as applicable) but after restarting the NAS and login as root the aliases set in the root login files were not part of the ssh login enviroment (I can't recall if the files had been in the root home area but I suspect not).

Why would I want to have a custom root environment ??.  Well I was at the time using uShare which does not automatically refresh.  Rather than sshing to the NAS, changing directory to the ffp/start and then running the './uShare.sh restart' command I just aliased the command to uShare-restart so I could just connect and type 'uShare-restart' at the prompt to get uShare to refresh.  Moving from this I would then have just written a script to kick off the ssh connection and fire the command from a Windows icon saving me the need to login manually and even typing anything.....

So if I want to put scripts in to copy file / run custom scripts, where is the best place to put them (called from system profile / new script in the ffp/start directory ?

Thanks
RB

Offline

 

#2 2008-07-18 09:52:18

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

I had modified the system profile file (ffp/etc/profile IIRC) to copy the login setup files to the root home area (can't recall the default login shell but .cshrc .profile .kshrc as applicable)

Wrong place. Create a new start script for your root user in /ffp/start/, e.g. /ffp/start/root-user.sh

Code:

#!/ffp/bin/sh

# PROVIDE: root_user
# BEFORE: SERVERS
# REQUIRE: passwd

. /ffp/etc/ffp.subr

name="root_user"
start_cmd="root_user_start"
stop_cmd=:

root_user_start()
{
        # clear root's password
        usermod -p '' root
        # set home dir
        mkdir -p /mnt/HD_a2/home/root
        usermod -d /mnt/HD_a2/home/root root
}

run_rc_command "$1"

PS: I haven't tested this exact script. Let me know if there're problems. Feel free to add/remove features.

Offline

 

#3 2008-07-18 10:36:52

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

Thanks Fonz.

One more related question.

Which order are the scripts in ffp/start run ?

If I had a number of scripts I wanted to run but script 1 had to be run before script 2, script 3 and script 4 without chaining them together by calling from a master script.  Is the order they would be executed in the ffp/start directory timestamp based or filename based or something else ?

Thanks
RB

Offline

 

#4 2008-07-18 10:54:45

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

Which order are the scripts in ffp/start run ?

The scripts are chained through 'PROVIDE', 'REQUIRE', and 'BEFORE' tags in each script. They are run by /ffp/etc/rc in the order shown by:

Code:

rcorder /ffp/start/*.sh

You can find a more detailed explanation in rcorder(8):

Code:

man 8 rcorder

Offline

 

#5 2008-07-18 11:49:57

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

Great, thanks.

I will have a look at that.

I am now investigating the tool chain creation and getting it setup on my SUN VM software (Win XP) as I already have a Linux environment installed there.

Regards
RB

Offline

 

#6 2008-07-18 12:21:18

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

I am now investigating the tool chain creation and getting it setup on my SUN VM software (Win XP) as I already have a Linux environment installed there.

If you want to compile stuff for ffp, I recommend trying the native tools, first. Creating a toolchain that will properly link against ffp libraries is a non-trivial task. Some packages will not work on recent CH3SNAS firmwares, if you get this wrong.

Offline

 

#7 2008-07-21 09:31:11

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

Ok,

So from this I am guessing you are suggesting compiling on the NAS it'self rather than on a PC using cross compiling.  Is this correct.

If this is the case, I have ffp 0.5 installed (base package) along with Transmission and Clutch (with their required packages like ncurses). 

Requirements for uShare are;

GNU C Compiler (gcc), 2.95 or later.
pkg-config.
Linux SDK for UPnP Devices (libupnp), 1.4.2 or later.
libdlna, 0.2.1 or later.

Hopefully the following will take care of these requirements;
gcc-4.1-2.tgz
pkg-config can be sourced from http://pkg-config.freedesktop.org/wiki/ and is said to have everything needed to compile it included.
UPnP is available from  http://pupnp.sourceforge.net/
libdlna is available from http://libdlna.geexbox.org/

So all I need to do is;
Install gcc-4.1-2.tgz, pkg-config source, uShare source, UPnP lib and libdlna.
Make pkg_config
Install pkg_config
Make uShare
Install uShare
Config uShare

If that sounds right then I will jump in and give it a go.  Anything obvious missing / seriously understated ?

Cheers
RB

Offline

 

#8 2008-07-21 09:46:31

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

Install gcc-4.1-2.tgz

That's not enough. You'll also need some or all of binutils, make, bash, autoconf, automake, coreutils, diffutils, flex, gettext, kernel-headers, libiconv, libtool, m4, ncurses, patch, pcre, readline, tcp_wrappers, zlib.

Offline

 

#9 2008-07-21 09:57:42

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

fonz wrote:

RimBlock wrote:

Install gcc-4.1-2.tgz

That's not enough. You'll also need some or all of binutils, make, bash, autoconf, automake, coreutils, diffutils, flex, gettext, kernel-headers, libiconv, libtool, m4, ncurses, patch, pcre, readline, tcp_wrappers, zlib.

Ok, are these dependencies of gcc ?.

If so I see you have them as packages for ffp 0.5 so I guess it is just a case of resync and funpkg -i for them ?.

Cheers
RB

Offline

 

#10 2008-07-21 10:01:29

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

Ok, are these dependencies of gcc ?.

No. binutils contains assembler and linker, make is required to run interpret a Makefile (basically always needed), the rest are other tools often needed or just headers files with definitions. There are manpages and websites for each of the project that explains its function.

Offline

 

#11 2008-07-21 10:41:39

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

fonz wrote:

RimBlock wrote:

Ok, are these dependencies of gcc ?.

No. binutils contains assembler and linker, make is required to run interpret a Makefile (basically always needed), the rest are other tools often needed or just headers files with definitions. There are manpages and websites for each of the project that explains its function.

Right so these are the tools that are and maybe needed for a development system.

Do you know of a site with a quick guide of what is required in full to build a system capable or compiling binaries.

So far I have;
binutils,
make,
bash,
autoconf,
automake,
coreutils,
diffutils,
flex,
gettext,
kernel-headers,
libiconv,
libtool,
m4,
ncurses,
patch,
pcre,
readline,
tcp_wrappers,
zlib

I do not know where you have got this list from although I am sure you are correct.  I also do not know which are compulsary and are optional.  How can I tell or is it a case of looking up each package and seeing what it's dependancies are and adding them to the list to be installed.  It would be great if there is a place out there which says xxxx, xxxxxx, xxxxxx are min requirements and yyyy, yyyyy and yyyyy are optional depending on dependancies of the package you are trying to compile.

uShare only have dependancies of;
GNU C Compiler (gcc), 2.95 or later.
pkg-config.
Linux SDK for UPnP Devices (libupnp), 1.4.2 or later.
libdlna, 0.2.1 or later.

I will also have a bit of a dig around to try and find this info.

Cheers
RB

Offline

 

#12 2008-07-21 10:49:57

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

Do you know of a site with a quick guide of what is required in full to build a system capable or compiling binaries.

That really depends on the package you're trying to build. Each package might require different tools.

In general, the Linux From Scratch project has a good list of really basic required tools to compile stuff. The minimal list is:
  http://www.linuxfromscratch.org/lfs/vie … ter05.html

while a more complete system will have:
http://www.linuxfromscratch.org/lfs/vie … ter06.html

Because this list is long, and varies, I generally recommend to just install all ffp packages. It doesn't take up so much space (you have several hundred GB disk space, right?). And nothing will be started automatically unless you ask for it.

Offline

 

#13 2008-07-21 10:56:27

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

Haha.

Ok so go with the intall everything option.  Sounds like it will be the easiest..... :-).

I can troubleshoot the shell scripts and config files as long as I have the basic environment set.

Thanks for the links.  I also found http://www.tuxfiles.org/linuxhelp/softinstall.html which gives a good top level overview of the unpack, config, make, install package from source tutorial.

Oh is there an easy 'install all packages not installed' option for ffp 0.5 ?  Will doing the resync and the funpkg -i *.tgz just skip the packages that are already installed but continue and install all the others rather than halting ?

Cheers
RB

Offline

 

#14 2008-07-21 11:06:00

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Custom user login environments (ssh) - How ?

RimBlock wrote:

Will doing the resync and the funpkg -i *.tgz just skip the packages that are already installed but continue and install all the others rather than halting ?

yes, it will install what's new, and skip the rest.

ps: you should run 'funpkg -u *.tgz', first, so you get your packages up-to-date.

Offline

 

#15 2008-07-21 11:14:28

RimBlock
Member
Registered: 2008-04-24
Posts: 77

Re: Custom user login environments (ssh) - How ?

fonz wrote:

RimBlock wrote:

Will doing the resync and the funpkg -i *.tgz just skip the packages that are already installed but continue and install all the others rather than halting ?

yes, it will install what's new, and skip the rest.

ps: you should run 'funpkg -u *.tgz', first, so you get your packages up-to-date.

Cool,

I will give it a try tonight if the wife and kids allow me too :-).

Many thanks for the advice Fonz.

I will update in a new thread for trying to get uShare compiled if there seems to be some progress ;-).

Cheers
RB

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB