LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-31-2005, 02:33 PM   #1
Palula
Member
 
Registered: May 2005
Location: Brazil
Distribution: Fedore Core 3
Posts: 138

Rep: Reputation: 15
Variables Used in Banners


Iīm not sure but I think this post belongs to another section of the forum branch like, for example, the general or distro sections because I donīt think this post regards anything relevant to specific programs. Well... Anyway...

Iīm using vsftpd an I want to create a customized banner for logging users. And the thing is, I saw somewhere that the Unix bash recognizes specific variables that can represent pre-formatted environmental info. Like for example, "%u" represents the username (I think)...

I would like to create a nicely customized banner that can show the userīs name, his/her IP address and many other things that can be done with these variables.

Does anyone have a list of those? Iīve looked for some in google but I didnīt find any, except the "%u". Is "%u" all there is?

Thanks a lot!
 
Old 11-01-2005, 08:19 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,681
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
This is a little confused. You talke about vsftp, bash, parameters, banners and logging all at once.

I don't use vsftp but I'm if its like the other ftp variants it has its own shell and doesn't use the user shell (usually bash) defined in /etc/passwd for a user. That shell is used on logins using telnet, ssh or direct logins such as on the console not on ftp/scp transfers.

%u has no meaning within the shell. In fact the only thing I can think of off the top of my head that defines things with "%" is the date command. "date +%u" would return the day of the week. There is a subformat within one of the bash variable for %U but not %u (case is significant in UNIX/Linux).

What you are calling parameters is more properly called variables. Bash does have several predefined ones (HOME & PS1 for example). To see all the ones defined do "man bash" then locate "Shell Variables". To reference a variable you use the dollar sign ($) not the percent sign (%) so to call the HOME variable you call it $HOME.

I'm not sure what you mean by "banner". A banner would be something that displays on the screen but I don't know why you'd want to banner a user's own session back to them. I suspect you mean instead you'd like to be able to log the user's information.

For standard logins just doing the "who" command will give you the login ID, the tty, the time of login and the IP or hostname from which it came for all logins. Doing "who am i" on the user's terminal will show just that user's information. You can also use the "finger" command to see information for specific users by following it with the user's login ID.

Note the above is for normal ssh/telnet/direct logins. The ftp setup does not use that methodology so has a limited set of commands some of which have the same name (e.g. pwd, ls) as those used in the shells but are not actually the same.

Use the "man" command for details on any command on whichy you need more info examples for the commands I've mentioned above:

"man bash"
"man vsftp"
"man ftp"
"man who"
"man finger"
"man date"
 
Old 11-01-2005, 11:46 AM   #3
Palula
Member
 
Registered: May 2005
Location: Brazil
Distribution: Fedore Core 3
Posts: 138

Original Poster
Rep: Reputation: 15
Iīm a bit confused. Iīll try to explain:

When I say banner, I mean something like this:

Code:
----------------------------
         Welcome
----------------------------

Use of this system constitutes consent to security monitoring and testing. 
All activity is logged with your host name and IP address.

 Hi (user)@(domain).
 Your IP adress is: (IP adress).
 Local Time is: (local time).
 Average throughput for this server is: (avgthroughput).
 (numpeople) have visited this server in the last 24 hours.
Everything in parenthesis should be a bash variable (if possible).
 
Old 11-03-2005, 09:55 AM   #4
Palula
Member
 
Registered: May 2005
Location: Brazil
Distribution: Fedore Core 3
Posts: 138

Original Poster
Rep: Reputation: 15
Here is another concern of me? Besides the one regarding the banner (wich I donīt have clue yet)...

Files can be uploaded to my FTP from the logged users. How can I create a default permission for uploaded files to be:
- write and read by the owner
- read by the group
- read by others
(Never execute)

The mask should be: 644 for all files right?
I want this to be the regular upload mask for all files uploaded to my FTP.

Just for the record. The uploads Iīve done so far, canīt be executed anyway. But how can I know for sure, executing files is prohibited?

Thanks a lot.

Last edited by Palula; 11-03-2005 at 12:09 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with PostNuke banners Sigfrid Linux - Software 1 05-12-2004 12:34 PM
how do i remove server banners in apache2? groovin Linux - Networking 7 12-12-2002 02:32 PM
how do I create anamated banners ??? BaerRS Linux - General 4 05-30-2002 06:44 PM
Banners Eternal LQ Suggestions & Feedback 4 03-17-2002 10:39 AM
Banners SkYzOpReNiCk LQ Suggestions & Feedback 1 10-14-2001 03:11 PM


All times are GMT -5. The time now is 03:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration