# Installing ports with portsnap??



## Rumor (Aug 7, 2010)

I am trying to download and install ports.tar.gz. A tutorial told me to do this but the command isn't working for me. I'm sure it's a noob question but I'm noob at FreeBSD for the most part  ..sorry.

This is what I get:







My best guess is that this is not FreeBSD  ...if so, how do I get into it?


----------



## DutchDaemon (Aug 7, 2010)

What is the output of [cmd=]uname -a[/cmd]
? 

Portsnap wasn't part of the base system until FreeBSD 6.3 (IIRC).


----------



## SirDice (Aug 9, 2010)

While you're at it, disable the ability for root to login via ssh. It's not at all secure. 
Login using your own user account and use security/sudo or su(1).


----------



## gkontos (Aug 9, 2010)

Also it is a bad idea to use bash for root.

@DutchDaemon
Freebsd 6.0


----------



## kpa (Aug 9, 2010)

Do you have any recommendation for a bourne compatible shell other than bash? 

(And why does FreeBSD default to tcsh for root :OOO)


----------



## DutchDaemon (Aug 9, 2010)

1) mksh is nice, others will advise e.g. zsh
2) leave root shell alone, use toor account for alternative shell


----------



## DutchDaemon (Aug 9, 2010)

If OP doesn't show up here anymore I might as well delete this thread ..


----------



## mechanic (Aug 15, 2010)

Why is bash shell not recommended for root? Just asking because Linux users are happy with that, and I have .bashrc already sorted for root use.


----------



## phoenix (Aug 15, 2010)

BASH is installed as /usr/local/bin/bash.  /usr/local may not be accessible during a single-user boot, or a repair boot, or when you need to login as root before all filesystems are mounted.

TCSH is installed as /bin/tcsh.  /bin is always part of / (just a directory, not a filesystem), thus it's always available.

Besides, you really shouldn't be logged in as root long enough to require all the features of bash.  If you find yourself logged in as root and missing bash, you need to take a step back and take another look at what you are doing, and investigate things like su, sudo, MAC, the operator group, etc.


----------



## mechanic (Aug 15, 2010)

I'm unconvinced. None of that overcomes the possible confusion of two different working shells.


----------



## kpa (Aug 15, 2010)

There's very little you have to do as root directly if you set up sudo properly and you can use the shell of your choise on your regular user account and don't have use (t)csh at all.


----------



## DutchDaemon (Aug 15, 2010)

And there's always the toor account as an alternative root account with a non-standard shell.


----------



## UNIXgod (Aug 15, 2010)

If your system gets compromised with root shell turned on in ssh you just gave the miscreants the super user account.


----------



## gcooper@ (Aug 15, 2010)

Just for future reference, here's what I do on multiple machines if I want bash:


```
cat >> ~/.shrc <<EOF
if [ -x /usr/local/bin/bash ]; then
    /usr/local/bin/bash -c true && exec /usr/local/bin/bash
fi
EOF
```

I realize it might seem excessive, but here's a breakdown:

NOTE: $- maps to the flags passed to bash/sh. -i is passed with interactive logins (and that's the only case I want to deal with in an interactive shell), and it would be present in the string, so I could check like so:


```
case "$-" in
*i*)
    echo "hello interactive user"
    ;;
esac
```

However, .shrc isn't executed unless it's an interactive login, so this is moot. It's a better check than looking for PS1, etc (that's another method, but it's more faulty). See sh(1) for more details on this.

1. 
	
	



```
[ -x /usr/local/bin/bash ]
```
 checks to make sure that the shell is present (this would fail most of the time in single-user mode).
2. 
	
	



```
/usr/local/bin/bash -c true
```
 checks to make sure that the shell isn't broken; this is to avoid the case where I do a port upgrade and break bash by accident -- I can still login with my non-privileged account via ssh.

With recent copies of CURRENT though (circa May/June?) I don't need to install bash though because sh(1) functions `properly' with history input, tab completion, etc thanks to jilles@ work in porting bits over from NetBSD..


----------

