Unix noob adventures

Where Penguins and Daemons chill together in the warmth of the Sun.

Moderators: SecretSquirrel, notfred

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 1:24 pm

flip-mode wrote:
Buub wrote:What's so hard about just logging in as yourself, then doing an su?
Well, now that I've made myself a member of the wheel group, there is nothing hard about it at all :wink:

As for sudo, I'm going to have to check it out; as of this moment, I don't know what sudo is.


Sudo is a command that allows you to run another single command as root. It allows you to do root things without actually logging in as root. It's safer because you have to explicitly say "do this as root".

For example, logged in as yourself:
Code: Select all
sudo emacs /etc/hosts
sudo vipw root

etc...
Buub
Maximum Gerbil
Silver subscriber
 
 
Posts: 4204
Joined: Sat Nov 09, 2002 11:59 pm
Location: Seattle, WA

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 1:24 pm

I want to repost something from earlier, but am happy to report that I've scratched three things off the list just over the last few hours.

flip-mode wrote:Here are just a list of questions / tasks I have on my mind:

adding a second network card - how to install and configure
can I change my user name?
configuring FreeBSD as a firewall
how to create a network share that can be seen by windows machines?

Also, regarding pfsync and CARP, is the main idea redundancy? I was considering using pfSense and having an identical backup computer and doing something like a once a week image, although pfsync and CARP does seem to be a more sophisticated solution. But pfSense looks super easy to use. There is something to be said for ease of use, so does anyone have any experience with pfSense?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 1:27 pm

Buub wrote:Sudo is a command that allows you to run another single command as root.
So su actually turns the user into root? Is there a way to turn that off?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 1:30 pm

Another question: are programs actually "installed" on the system or are they basically just placed on the system and once they are there you just run them? If it is the latter, do you just delete the program file to "uninstall" it? Also if it is the latter, how many different places are programs placed in? I know of /bin /sbin and /usr/sbin - any others?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 1:51 pm

flip-mode wrote:Also, regarding pfsync and CARP, is the main idea redundancy? I was considering using pfSense and having an identical backup computer and doing something like a once a week image, although pfsync and CARP does seem to be a more sophisticated solution.

It's a completely different level of redundancy versus having a cold spare with a backup image. With pfsync and CARP (which I believe pfSense can use in certain configurations), you have two running machines and your stateful firewall information is synced between the two. That means if the active (master) dies suddenly, it will switch to the backup without dropping connections currently in progress. It's transparent from an external perspective. That means you can bring down one machine to apply security updates, hardware upgrades or whatever and have the other transparently take over without a connectivity glitch. It allows continuous rolling upgrades, etc. without ever having connectivity down. You can also use arpbalance to do load balancing with multiple active masters, but I've never set that up.
bitvector
Grand Gerbil Poohbah
 
Posts: 3234
Joined: Wed Jun 22, 2005 4:39 pm
Location: Mountain View, CA

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 2:00 pm

flip-mode wrote:Another question: are programs actually "installed" on the system or are they basically just placed on the system and once they are there you just run them? If it is the latter, do you just delete the program file to "uninstall" it? Also if it is the latter, how many different places are programs placed in? I know of /bin /sbin and /usr/sbin - any others?

Depends how you install it. When you install something with ports, it typically goes in the /usr/local/ hierarchy (/usr/local/bin, /usr/local/sbin/, etc., although you can override). It also provides a mechanism for uninstalling it (via pkg_delete or higher level port tools like portmaster or portupgrade if you use those). FreeBSD also has a binary packages system (pkg_add, etc.) in addition to ports; most of the base system comes that way. For both ports and packages, you can use pkg_delete to remove them.

The FreeBSD handbook will answer most of your questions, BTW: http://www.freebsd.org/doc/en/books/handbook/
bitvector
Grand Gerbil Poohbah
 
Posts: 3234
Joined: Wed Jun 22, 2005 4:39 pm
Location: Mountain View, CA

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 2:05 pm

flip-mode wrote:
Buub wrote:Sudo is a command that allows you to run another single command as root.
So su actually turns the user into root? Is there a way to turn that off?


su is used for switching users in general -- log on as one user, su to another account, do what you need to with that account, exit, and you're back in the login account. The simple way to turn su off is to use chmod to remove the execute bits. chmod 644 /usr/bin/su would do it. There may be unforeseen consequences to doing that, though; perhaps some other utility depends on su, somehow.

You can use sudo the same way: type sudo -s, enter your password (not root's password) and you've got a root shell. This even works if your root account is disabled, as in Ubuntu. sudo can be very fine-grained. man sudoers may be helpful, but googling for a tutorial might be best.
Think for yourself, schmuck!
i5-2500K@4.3|Asus P8P67-LE|8GB DDR3-1600|Powercolor R7850 2G|1.5TB 7200.11|1988 Model M|Saitek X-45 & P880|Logitech MX 518|Dell 2209WA|Sennheiser PC151|Asus Xonar DX
bthylafh
Grand Gerbil Poohbah
 
Posts: 3189
Joined: Mon Dec 29, 2003 11:55 pm
Location: Southwest Missouri, USA

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 10:28 pm

I've never used it myself, but I believe that Samba is used for file and printer sharing between *nix and windows machines. So if you want to make a network share that's viewable in windows you could try looking into that.

And yeah, putty is a neat little program. I use it at work to telnet into my two solaris machines that I don't have monitors and keyboards for (and occasionally my RHEL box when I need to do something quick and I'm too lazy to use the kvm switch). I just wish there was a way to increase the amount of lines I can scroll back to.
jmdaley
Gerbil In Training
 
Posts: 5
Joined: Mon Dec 08, 2008 10:27 pm

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 10:33 pm

flip-mode wrote:can I change my user name?

Yes, you can just edit /etc/passwd and change the username there - it is stored as user id in the system and /etc/passwd does the mapping from user name to user id.
flip-mode wrote:how to create a network share that can be seen by windows machines?

As jmdaley mentioned, take a look at Samba, although the config can be pretty scary -start as simple as possible. Also look for the BSD way of installing it rather than grabbing the source straight from Samba and trying to compile it up from scratch.
notfred
Grand Gerbil Poohbah
 
Posts: 3749
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: flip's Unix noob adventures

Postposted on Wed Dec 10, 2008 11:02 pm

notfred wrote:
flip-mode wrote:can I change my user name?
Yes, you can just edit /etc/passwd and change the username there - it is stored as user id in the system and /etc/passwd does the mapping from user name to user id.

Probably the best way to do it in FreeBSD is:
Code: Select all
pw usermod <old name> -l <new name>

Because that will propagate the updates to both /etc/passwd AND /etc/master.passwd, which should really be consistent, and it will also call pwd_mkdb which will also update /etc/spwd.db and /etc/pwd.db (Berkeley DB files that contain the same user info).
bitvector
Grand Gerbil Poohbah
 
Posts: 3234
Joined: Wed Jun 22, 2005 4:39 pm
Location: Mountain View, CA

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 9:57 am

You fellas are helpful. I'll take a look at BSD's Samba.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 10:55 am

Hmm, when I left work yesterday, the system was connected to the network. When I get here today, the system is not connected to the network. /etc/netstart does nothing, if that is even the right thing to try. Any help?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 1:47 pm

flip-mode wrote:Hmm, when I left work yesterday, the system was connected to the network. When I get here today, the system is not connected to the network. /etc/netstart does nothing, if that is even the right thing to try. Any help?

You usually have to follow that with a switch:
/etc/netstart start

As for su, the way Gentoo handles it is that a user needs to be part of a specific group, wheel, in order to use. If the user isn't in that group, running su will return command not found, or something of the sort. That's only if your distro supports it, and it may be a different term.

flip-mode wrote:Another question: are programs actually "installed" on the system or are they basically just placed on the system and once they are there you just run them? If it is the latter, do you just delete the program file to "uninstall" it? Also if it is the latter, how many different places are programs placed in? I know of /bin /sbin and /usr/sbin - any others?

Programs aren't installed per se. The files need to run the program are copied to the drive, and once it's there, you're good to go. When you want to remove it you delete the files. Package managers help keep things in order and handle a lot of the trickier things for you. Again, if your distro supports it.
The best things in life are free.
http://www.gentoo.org
Guy 1: Surely, you will fold with me.
Guy 2: Alright, but don't call me Shirley.
titan
Grand Gerbil Poohbah
 
Posts: 3276
Joined: Mon Feb 18, 2002 7:00 pm
Location: Great Smoky Mountains

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 2:27 pm

/etc/netstart start did the trick titan :P

As for su, yes I found out that in FreeBSD I needed to be a member of wheel and I was able to add myself to that group, and now I am able to su just fine.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 2:51 pm

su = make me other user
sudo = execute this one command as other user

su is 'cmd' in the run prompt
sudo is the app in the run prompt

Sorry for the inspecificity, but is this at all clear?
Siglessness is boring.
Image - M4800-Eight1
Image - Vargr-Z97
Forge
Lord High Gerbil
 
Posts: 8046
Joined: Wed Dec 26, 2001 7:00 pm
Location: SouthEast PA

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 2:53 pm

Yep, totally clear.

sudo = do this one thing as root
su = act as root until exit

so when I type make install clean is that actually three commands?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 2:59 pm

One command, two arguments.

Make is what it sounds like. The latter two words are 'sections' passed to make.

It will run 'make install' and then 'make clean'. My BSDism is rusty, but I think it'll run just plain 'make' first, if it hasn't been run before. (think of it as 'make (main)').

I've seen some torturous sequences, primarily when building/installing the linux kernel. 'make clean oldconfig bzimage modules install clean mrproper' - I think that was my most horrible concatenation outside of German practice.
Siglessness is boring.
Image - M4800-Eight1
Image - Vargr-Z97
Forge
Lord High Gerbil
 
Posts: 8046
Joined: Wed Dec 26, 2001 7:00 pm
Location: SouthEast PA

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 3:01 pm

Nope, that is one command "make" with two arguments "install" and "clean". These arguments are targets specified in the makefile for make to do.
notfred
Grand Gerbil Poohbah
 
Posts: 3749
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: flip's Unix noob adventures

Postposted on Thu Dec 11, 2008 3:09 pm

OK, thanks. I'm gonna have to study this. When you run make is that essentially compiling something from source?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Fri Dec 12, 2008 8:42 am

make is a framework for compiling projects. Basically there's a file, informationally named the makefile, which contains the big plan. When you run make configure, it adjusts a bunch of subtle (and sometimes not subtle) variables to align the project with your OS, CPU arch, version of make/gcc/whatall. After that you run make (no arg) and it compiles the main body of the project. Sometimes you'll have 'accessory' makes, which compile modules or the GUI frontend, but these are fairly rare. Make install goes through and copies the compiled binaries and libs out to where they'll run from, leaving the raw source alone. make clean will delete any compiled stuff out of the source tree, readying it for a different config/compile run.

There are many others as well. It's always a good idea to crack open any unfamiliar makefiles and take a look before make'ing against them.
Siglessness is boring.
Image - M4800-Eight1
Image - Vargr-Z97
Forge
Lord High Gerbil
 
Posts: 8046
Joined: Wed Dec 26, 2001 7:00 pm
Location: SouthEast PA

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 11:08 am

An update on how things are going:

I took the BSD machine I was using in to work. There is more time to play with it there since I don't have to be a dad at the same time while at work, and since this BSD journey is going to (hopefully) result in some benefit to work I don't feel so bad devoting work time to it.

At the same time, I have installed FreeBSD on another machine here at home. I put two NICs in this machine in anticipation of making the machine a firewall. Perhaps as a result, neither network card was configured during the OS install. I'm now trying to figure out how to get at least one of them installed.

On this second machine, I also opted to make the machine an NFS server. My understanding is that this was something that was necessary for file sharing, but my understanding is pretty fuzzy.

I am getting much more used to the command line. Not to get too spacey, but I think even my conscious perception of it has changed. It used to appear to me as just a blinking cursor and a place where I could basically cd from one directory to another, but beyond that was essentially a point with no depth and no breadth. But now it appears as a much less finite thing, almost a place without dimensions where the only limits are due to my own lack of knowledge. That may sound weird, but it is simply what came to mind as I was thinking about my increased comfort with the command line.

None the less, this is not an "install it and be productive" operating system. The productive capabilities of the *nixes are certainly buried beneath an interface (the command line) that essentially hides from you and that you are forced to come and find, and it is much like are archeological dig: the fullness of it is slowly uncovered by digging through man pages and feeling around google searches rather than immediately exposed as when one turns on a light and sees the contents of a dark room.

Any tips on how to install and configure the NICs would be appreciated.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 11:58 am

flip-mode wrote:On this second machine, I also opted to make the machine an NFS server. My understanding is that this was something that was necessary for file sharing, but my understanding is pretty fuzzy.
NFS is file sharing for Unix, not for Windows (unless you run an NFS client in Windows). Windows uses SMB/CIFS for file sharing and that's provided by Samba.
notfred
Grand Gerbil Poohbah
 
Posts: 3749
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 12:29 pm

flip-mode wrote:I am getting much more used to the command line. Not to get too spacey, but I think even my conscious perception of it has changed. It used to appear to me as just a blinking cursor and a place where I could basically cd from one directory to another, but beyond that was essentially a point with no depth and no breadth. But now it appears as a much less finite thing, almost a place without dimensions where the only limits are due to my own lack of knowledge. That may sound weird, but it is simply what came to mind as I was thinking about my increased comfort with the command line.

It doesn't sound terribly weird to me. It sounds like you're finally getting comfortable enough with the command line to be truly productive with it.

GUI tools make it really easy to do the things the tool designers thought of, but difficult (or impossible) to do the things they didn't think of. Command line lets you do pretty much anything you want, but there's a learning curve you need to come up first.
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 37845
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 4:49 pm

flip-mode wrote:Any tips on how to install and configure the NICs would be appreciated.

Seriously, as I mentioned earlier, you should look at the FreeBSD Handbook. It's an excellent reference and probably 90% of the questions you've asked are directly answered in it. Section 11.8 "Setting Up Network Interface Cards" covers configuring your network cards.
bitvector
Grand Gerbil Poohbah
 
Posts: 3234
Joined: Wed Jun 22, 2005 4:39 pm
Location: Mountain View, CA

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 8:32 pm

bitvector wrote:Seriously, as I mentioned earlier, you should look at the FreeBSD Handbook. It's an excellent reference and probably 90% of the questions you've asked are directly answered in it. Section 11.8 "Setting Up Network Interface Cards" covers configuring your network cards.
My bad. I have been crawling all through that thing but didn't manage to stumble upon that section. I'm lame.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 9:31 pm

Um, yeah, a little reading and a quick ee /etc/rc.conf and I've got both NICs connected DHCP style. Damn, I almost feel powerful. :lol:
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Sun Dec 14, 2008 9:45 pm

You're doing good, but right about here is where you're most likely to 'rm -rf /' in a moment of inattention.
Siglessness is boring.
Image - M4800-Eight1
Image - Vargr-Z97
Forge
Lord High Gerbil
 
Posts: 8046
Joined: Wed Dec 26, 2001 7:00 pm
Location: SouthEast PA

Re: flip's Unix noob adventures

Postposted on Mon Dec 15, 2008 2:18 pm

Thanks Forge. I am having fun with this. Thanks for the patience everyone.

I just ran

    Xorg -configure
and it recognized my Dell 2007 FPW and claimed to recognize my mouse. But when I run

    Xorg -conf xorg.conf.new
the mouse does not work. Any thoughts?

Eventually, I want to get either KDE or Gnome (don't care which) running so I can do some web browsing and such.

Now that I have my two NICs up and running I am going to start exploring the firewall. I want an inclusive firewall I think (where only the traffic I specify is allowed) and I want NAT and port forwarding. Besides "read the handbook", is there any other advice that anyone has or any "heads up" type stuff to be said?

The other task at the top of the list is email. I haven't even gotten started on that.

Oh, and Samba.

And eventually, web browsing.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: flip's Unix noob adventures

Postposted on Mon Dec 15, 2008 2:56 pm

flip-mode wrote:Thanks Forge. I am having fun with this. Thanks for the patience everyone.

I just ran

    Xorg -configure
and it recognized my Dell 2007 FPW and claimed to recognize my mouse. But when I run

    Xorg -conf xorg.conf.new
the mouse does not work. Any thoughts?


The internet, put your conf up on it.
Siglessness is boring.
Image - M4800-Eight1
Image - Vargr-Z97
Forge
Lord High Gerbil
 
Posts: 8046
Joined: Wed Dec 26, 2001 7:00 pm
Location: SouthEast PA

Re: flip's Unix noob adventures

Postposted on Mon Dec 15, 2008 6:42 pm

I was trying to find out how to email the whole xorg.conf.new file to myself so I could copy/paste the thing, but it looks like it will take a while to figure all that out. So here is just the mouse section:

Code: Select all
Section "InputDevice"
               Identifier "mouse0"
               Driver      "mouse"
               Option     "Protocol" "auto"
               Option     "Device" "/dev/sysmouse"
               Option     "ZAxisMapping" "4 5 6 7"
Endsection
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

PreviousNext

Return to Linux, Unix, and Assorted Madness

Who is online

Users browsing this forum: No registered users and 3 guests