How to chroot a single ftp user in solaris 10
Hi,
I need to lock down a single ftp user so they cannot see outside of their home directory. Any advice or guides on the best way to do this?
Thanks,
Then you have to create a file /etc/shells (if it does not exist yet) where you have to put in every login shell with which "ftp" is allowed (i.e. if the user with the restricted shell is the only ftp user then the only entry is: /usr/lib/rsh. If you have another user with the Korn shell as login shell and this user should be able to "ftp" then you have to add the Korn shell as well).
Similar Messages
-
Change group of user in solaris
i have a doubt as to how to change group of a user in solaris. I want to change the group of the user. Please, do the needful.
regardsFor Oracle specific questions you can try Database forum, for OS specific ones I already addressed you Create user in solaris, and Sun has its own site as well (http://www.sun.com).
-
How to mount USB & CDROM drives from single user mode - Solaris boot disk?
Hi All,
I need to carry out ufsrestore on a single newly replaced system disk (no redundancy / mirroring) from either USB or CDROM drives from the following steps:
( i ) GRUB => e, e, cdrom –s, Enter, b (boot from Solaris 10 x86 media).
( ii ) Choose menu 1 for Install Solaris Interactive Mode to reach single user mode.Below are the commands that I have tried in single user mode without success:
mount –r –F pcfs /dev/dsk/c1t0d0p0 /cdrom (after unmount Solaris CD)
mount: /dev/dsk/c1t0d0p0 is not a DOS filesystem.
svcadm –v enable smserver
svcadm: Pattern ‘smserver’ doesn’t match any instances
svcadm enable autofs
svcadm: Pattern ‘autofs’ doesn’t match any instances
devfsadm
devfsadm: mkdir failed for /dev 0s1ed: Read-only file system
mkdir /mnt
mkdir: Failed to make directory “/mnt”; Read-only file systemPart of the problem is due to the current READ ONLY filesystems which does not allow the creation of mount point such as /mnt.
I have been able to create both / root (/dev/dsk/c1t0d0s0) and /export/home (/dev/dsk/c1t0d0s0) filesystems with newfs that are awaiting for restore using ufsrestore.
The only option I am left with is to attach a secondary disk to install Solaris 10 on either of them before bring the system to multi-user mode so that service such as volmgt, autofs, volfs are available to access USB & CDROM drives.
Any suggestion on how to resolve this issue?
Many thanks,
JackHi JKGN,
Is the directory a located under the root filesystem. ie /a? Are there any other mount point for say USB drive as well? I am not in a position to try it out right now but will get back
to you soon on whether /a exist or not.
Btw, the last thing I managed to do on this system at the time was added a secondary 1TB internal disk with the intention to restore both / and /export/home data onto this disk while
making use of all the disk device management services such as the following services only available in a fully installed Solaris system (both single & multi-user modes) installed on the
primary disk:
# svcs smserver
STATE STIME FMRI
online Jun_08 svc:/network/rpc/smserver:default
# svcs autofs
STATE STIME FMRI
online Jun_08 svc:/system/filesystem/autofs:default
# devfsadm
# iostat -En
c1t0d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: ATA Product: SAMSUNG HD321KJ Revision: 0-11 Serial No:
Size: 320.07GB <320072932864 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 41 Predictive Failure Analysis: 0
c0t0d0 Soft Errors: 0 Hard Errors: 5 Transport Errors: 0
Vendor: PHILIPS Product: DVD+-RW DVD8801 Revision: AD21 Serial
Size: 17.54GB <17538875392 bytes>
Media Error: 0 Device Not Ready: 5 No Device: 0 Recoverable: 0
Illegal Request: 10 Predictive Failure Analysis: 0
c2t0d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: JetFlash Product: Transcend 16GB Revision: 1100 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 7 Predictive Failure Analysis: 0
# rmformat
Looking for devices...
1. Volmgt Node: /vol/dev/aliases/cdrom0
Logical Node: /dev/rdsk/c0t0d0s2
Physical Node: /pci@0,0/pci-ide@1f,1/ide@0/sd@0,0
Connected Device: PHILIPS DVD+-RW DVD8801 AD21
Device Type: DVD Reader/WriterHowever, I was disappointed that "iostat -En" has not found the secondary disk (1 TB) even though it was available earlier, for Solaris installation as the only disk on the same system.
As a result, I am left with no option but the need to rebuild this system with only a single primary disk while in single user mode. However, the single user mode that I am in is the
one from Solaris installation disk with restrictive (_cannot create folder for mount point or running disk management utilities_) capability such as those services just covered, compared to one from a completed Solaris installation system with full access to all filesystems and utilities / commands in general.
I would very much value your assistance on how to mount both CD & USB in this restrictive limited Read Only OS (assume that it is running from memory) in order to get complete access to
the blank primary disk so that full restore with ufsrestore could take place.
Thanks in advance,
Jack
Edited by: 797805 on 9/06/2012 04:15 -
Hi All,
I am working with SharePoint 2013 designer workflow. we are using office 365.
Our requirement to send email to multiple users, get the user groups from lookup list people and groups column.
But SP designer sending emails to the first user alone.
Please guide me to proceed.
Advance Thanks.
Regards
Jenkins NS
Thanks and Regards Jenkinsfinally I got a solution
Identified a workaround to solve the issue using SharePoint designer.
Step 1
Create a lookup list Example department
Columns
Title (by default) – Single line of text
Users – Person or Group
Emails – Multiple lines of text
hidden the Emails column (go to content type and set the column as hidden)
Create a SharePoint designer Workflow
Start Workflow automatically when an item is created
Also Start Workflow automatically when an item is changed
Workflow Stage 1
Set Emails to current Item: Users
The workflow will get all users email ids and add in the Emails column delimiter as semicolon.
Step 2
Create a custom list to get the email ids and send email
Create a lookup column ex: analysis and refer department list, Allow multiple values
Then Create a SharePoint designer workflow
full details workflow steps please follow below
URL
http://jenkinsblogs.com/2015/04/30/how-to-send-emails-to-multiple-users-from-lookup-list-people-picker-field-using-sharepoint-designer-workflow/
Thanks and Regards Jenkins -
Retrieving ALL values from a single restricted user property
How can I retrieve ALL values of a single restricted user property from within
a .jpf file?
I want to display a dropdown list within a form in a JSP which should contain
all the locations listed in the property 'locations'. I ever get just the default
value when I access the property via
ProfileWrapper pw = userprofile.getProfileForUser(user);
Object prop = pw.getProperty("ClockSetup", "Locations");Well, the code you've got will retrieve the single value of the property
for the current user. You're getting the default value because the
current user doesn't have Locations property set, so the ProfileWrapper
returns the default value from the property set.
I assume you want to get the list of available values that you entered
into the .usr file in Workshop. If so, I've attached a
SetColorController.jpf, index.jsp, and GeneralInfo.usr (put in
META-INF/data/userprofiles) I wrote for an example that does just this.
It uses the PropertySetManagerControl to retrieve the restricted values
for a property, and the jsp uses data-binding to create a list from that
pageflow method.
For a just-jsps solution, you can also use the
<ps:getRestrictedPropertyValues/> tag. I've attached a setcolor-tags.jsp
that does the same thing.
Greg
Dirk wrote:
How can I retrieve ALL values of a single restricted user property from within
a .jpf file?
I want to display a dropdown list within a form in a JSP which should contain
all the locations listed in the property 'locations'. I ever get just the default
value when I access the property via
ProfileWrapper pw = userprofile.getProfileForUser(user);
Object prop = pw.getProperty("ClockSetup", "Locations");
[att1.html]
package users.setcolor;
import com.bea.p13n.controls.exceptions.P13nControlException;
import com.bea.p13n.property.PropertyDefinition;
import com.bea.p13n.property.PropertySet;
import com.bea.p13n.usermgmt.profile.ProfileWrapper;
import com.bea.wlw.netui.pageflow.FormData;
import com.bea.wlw.netui.pageflow.Forward;
import com.bea.wlw.netui.pageflow.PageFlowController;
import java.util.Collection;
import java.util.Iterator;
* @jpf:controller
* @jpf:view-properties view-properties::
* <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
* <view-properties>
* <pageflow-object id="pageflow:/users/setcolor/SetColorController.jpf"/>
* <pageflow-object id="action:begin.do">
* <property value="80" name="x"/>
* <property value="100" name="y"/>
* </pageflow-object>
* <pageflow-object id="action:setColor.do#users.setcolor.SetColorController.ColorFormBean">
* <property value="240" name="x"/>
* <property value="220" name="y"/>
* </pageflow-object>
* <pageflow-object id="action-call:@page:index.jsp@#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
* <property value="240,240,240,240" name="elbowsX"/>
* <property value="144,160,160,176" name="elbowsY"/>
* <property value="South_1" name="fromPort"/>
* <property value="North_1" name="toPort"/>
* </pageflow-object>
* <pageflow-object id="page:index.jsp">
* <property value="240" name="x"/>
* <property value="100" name="y"/>
* </pageflow-object>
* <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@">
* <property value="116,160,160,204" name="elbowsX"/>
* <property value="92,92,92,92" name="elbowsY"/>
* <property value="East_1" name="fromPort"/>
* <property value="West_1" name="toPort"/>
* <property value="success" name="label"/>
* </pageflow-object>
* <pageflow-object id="forward:path#success#begin.do#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
* <property value="204,160,160,116" name="elbowsX"/>
* <property value="201,201,103,103" name="elbowsY"/>
* <property value="West_0" name="fromPort"/>
* <property value="East_2" name="toPort"/>
* <property value="success" name="label"/>
* </pageflow-object>
* <pageflow-object id="control:com.bea.p13n.controls.ejb.property.PropertySetManager#propSetMgr">
* <property value="31" name="x"/>
* <property value="34" name="y"/>
* </pageflow-object>
* <pageflow-object id="control:com.bea.p13n.controls.profile.UserProfileControl#profileControl">
* <property value="37" name="x"/>
* <property value="34" name="y"/>
* </pageflow-object>
* <pageflow-object id="formbeanprop:users.setcolor.SetColorController.ColorFormBean#color#java.lang.String"/>
* <pageflow-object id="formbean:users.setcolor.SetColorController.ColorFormBean"/>
* </view-properties>
public class SetColorController extends PageFlowController
* @common:control
private com.bea.p13n.controls.ejb.property.PropertySetManager propSetMgr;
* @common:control
private com.bea.p13n.controls.profile.UserProfileControl profileControl;
/** Cached possible colors from the User Profile Property Set definition.
private String[] possibleColors = null;
/** Get the possible colors, based upon the User Profile Property Set.
public String[] getPossibleColors()
if (possibleColors != null)
return possibleColors;
try
PropertySet ps = propSetMgr.getPropertySet("USER", "GeneralInfo");
PropertyDefinition pd = ps.getPropertyDefinition("FavoriteColor");
Collection l = pd.getRestrictedValues();
String[] s = new String[l.size()];
Iterator it = l.iterator();
for (int i = 0; it.hasNext(); i++)
s[i] = it.next().toString();
possibleColors = s;
catch (P13nControlException ex)
ex.printStackTrace();
possibleColors = new String[0];
return possibleColors;
/** Get the user's favorite color from their profile.
public String getUsersColor()
try
ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
return profileControl.getProperty(profile, "GeneralInfo", "FavoriteColor").toString();
catch (P13nControlException ex)
ex.printStackTrace();
return null;
// Uncomment this declaration to access Global.app.
// protected global.Global globalApp;
// For an example of page flow exception handling see the example "catch" and "exception-handler"
// annotations in {project}/WEB-INF/src/global/Global.app
* This method represents the point of entry into the pageflow
* @jpf:action
* @jpf:forward name="success" path="index.jsp"
protected Forward begin()
return new Forward("success");
* @jpf:action
* @jpf:forward name="success" path="begin.do"
protected Forward setColor(ColorFormBean form)
// set the color in the user's profile
try
ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
profileControl.setProperty(profile, "GeneralInfo", "FavoriteColor", form.getColor());
catch (P13nControlException ex)
ex.printStackTrace();
return new Forward("success");
* FormData get and set methods may be overwritten by the Form Bean editor.
public static class ColorFormBean extends FormData
private String color;
public void setColor(String color)
this.color = color;
public String getColor()
return this.color;
[GeneralInfo.usr]
[att1.html] -
How to put a single stack item to an album?
Maybe a silly question, but I can't find out how to put a single item from a stack into an album. When I drag a stacked item to an album, the entire stack appears in the album. This is not what I want, I want to get the single item in the album.
I know I can make a single stacked item in an album to be the albumpick. But this is not enough. Sometimes I need to put two items from the same stack into this album.
Koen
Message was edited by: Koen van DijkenKoen van Dijken wrote:
Would this be as designed, and so a wrong use of stacks by me?
It is as designed but I don't think what you want to do is a particularly wrong use of stacks. I can see using stacks as a way to reduce clutter in the browser but still wanting to be able to get to individual images in the stack to use..
What is interesting is the wording in the Aperture users guide concerning stacks:
Dragging Stacks
You can drag an entire stack to a new location, *and you can drag specific images within a stack to a new location*. When a stack is closed, dragging the stack moves the entire stack. *When a stack is open, you can drag individual images to new locations in the Browser*. You can also drag images into a stack. If you drag an image within a stack into a different project, however, the entire stack moves to the new location.
(emphasis added)
So the first part sounds like you should be able to drag an image out of the stack to an album, the second just mentions dragging an image out of the stack in the browser.
And in way you can do this, the only thing is what you end up doing is unstacking the image you drag out. Not exactly what you would want to do.
I think it should be OK to place individual stack items into albums and have them remain in the stack. Any reason this would be a bad idea? -
How to update a single field in Word macro
Hello,
I am trying to create an AutoOpen() macro that will update the file name and path when user opens in a Word document, but I can't seem to find anything explaining how to update a single field, specifically the {FILENAME \p} field. There
are other fields in the document, so I do not want to update all the fields. Most of the links I found only explain how to update ALL fields. Can somebody please tell me how I can update only the filename and path field using an autoopen macro?
Thank youStefan's response is correct.
Here is a macro that should update only filename fields.
Sub FileNameFieldUpdateAllStory()
' Written by Charles Kyle Kenyon 15 November 2001 - modified for filename 10 Sept 2014
' repaired by Jezebel
' All Story Field Updater - Filename fields
Dim oField As Field
Dim oStory As Range
' On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
' This goes into headers and footers as well as the regular document
Do
For Each oField In oStory.Fields
If oField.Type = wdFieldFileName Then
oField.Update
End If
Next oField
Set oStory = oStory.NextStoryRange
Loop Until oStory Is Nothing
Next oStory
End Sub
See Installing Macros for help in using this.
Charles Kenyon Madison, WI -
Mapping of single Portal users to multiple backend user
Hello Experts,
It is possible to map single portal user to the multiple R/3 user? If yes, than what is procedure to achieve it?
I have a SAP Portal where some users have 2 user ID in ECC, but I need to in Portal the users have only one user ID and password. How can I do to these users can select between their 2 profiles in ECC? Is posible?
Thanks!
RegardsHi,
This is not possible since you would have used SSO to connect to the Backend. Either it is SSO or User Mapping is done, Portal User can only access the Backend with one User ID.
If you use SSO, for Example if the Portal User is UserA then you would have the UserA in the Backend too. It will use the UserA in backend to access. (Note: Single User can't access multiple Backend. Since we would have already maintained the Backend Connection details in the System and also in JCo Destination. So it is not possible for a User to access the Backend with two different Backends)
If you use User Mapping, then you can decide the User which it should use. (For ESS/MSS this is not recommended and it is not feasible too).
Regards,
Baskar.N -
How to change a single page orientation in pages
I would like to know if anybody knows how to change a single page orientation in Pages.
Thanks.Of course it unrotates the text if I'm editing the text box, but not when I'm resizing or changing font properties. And when editng the text and there is an image beside it, the image obscures the text which makes editing exasperating. And since I got a table on landscape that exceeds 7.5" width, when trying to edit the last 2 columns,those become invisible on portrait, hence I'm unable to edit. And so has to set the doc to landscape, set to 0-deg, edit, set it again to portrait and 90-deg, and repeat if I happen to need to edit those invisible columns. Really a great and efficient way to write my technical doc! Which you would know IF YOU HAD TRIED IT -don't appreciate your sarcasm!
You can defend this blatant failure all you want but this kind of inadequancy continues because people don't speak up and demand this reasonable function and instead are satisfied with work-arounds that makes things hard for relatively easy task. I'm a systems and applications designer, this is the type of "missing feature" that would cause our app to be rejected by our clients. Surely you realized that because the users demanded, since 10.7, window resizing can be done from all corners instead of just right corners (or was it only bottom right)? I was shocked when I discovered this 2yrs ago when I switched to Mac and started using Snow Leopard. I'm grateful that I can now resize on 4's. -
How to activate or deactivate a user-exit based a specific condition
hi all,
i want to activate or deactivate(make it trigger) a particular user-exit based in a condition.
can i do that. if yes please tell me how.
can we use COMMIT in user-exits or BADI's.
Thanks & Regards,
Saroja.Hello Saroja
The solution provided by Rich should be used for testing purposes only in the the reverted sense:
IF ( syst-uname ne '<specific user>' ).
RETURN.
ENDIF.
" Execute user-exit for specific user
However, for serious programming you should use a a better strategy. In principle, user-exits are either ON or OFF and, if they are ON, they are ON for <b>all </b>user which is usually not intended.
The following example shows a (possible) strategy how to execute user-exits based on specific conditions.
The SAP extension CATS0001 contains the component EXIT_SAPLCATS_001 with the following interface:
FUNCTION EXIT_SAPLCATS_001.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(SAP_TCATS) LIKE TCATS STRUCTURE TCATS
*" VALUE(SAP_PERNR) LIKE CATSFIELDS-PERNR
*" VALUE(SAP_DATELEFT) LIKE CATSFIELDS-DATELEFT
*" VALUE(SAP_DATERIGHT) LIKE CATSFIELDS-DATERIGHT
*" VALUE(SAP_DATEFROM) LIKE CATSFIELDS-DATEFROM OPTIONAL
*" VALUE(SAP_DATETO) LIKE CATSFIELDS-DATETO OPTIONAL
*" TABLES
*" SAP_ICATSW STRUCTURE CATSW
*" SAP_ICATSW_FIX STRUCTURE CATSW OPTIONAL
INCLUDE ZXCATU01.
ENDFUNCTION.
The include ZXCATU01 contains only the following coding:
CALL FUNCTION 'Z_EXIT_SAPLCATS_001'
EXPORTING
sap_tcats = sap_tcats
sap_pernr = sap_pernr
sap_dateleft = sap_dateleft
sap_dateright = sap_dateright
SAP_DATEFROM = SAP_DATEFROM
SAP_DATETO = SAP_DATETO
tables
sap_icatsw = sap_icatsw
SAP_ICATSW_FIX = SAP_ICATSW_FIX.
This function module is just a copy of the exit function module in the customer namespace.
Let us assume that your condition at which the user-exit should be executed is that the employee (SAP_PERNR) belongs to a specific controlling area. Thus, we make another copy of the original exit function module and call this fm within the "general" customer-specific exit function module:
FUNCTION z_exit_saplcats_001.
*"*"Local Interface:
*" IMPORTING
*" VALUE(SAP_TCATS) LIKE TCATS STRUCTURE TCATS
*" VALUE(SAP_PERNR) LIKE CATSFIELDS-PERNR
*" VALUE(SAP_DATELEFT) LIKE CATSFIELDS-DATELEFT
*" VALUE(SAP_DATERIGHT) LIKE CATSFIELDS-DATERIGHT
*" VALUE(SAP_DATEFROM) LIKE CATSFIELDS-DATEFROM OPTIONAL
*" VALUE(SAP_DATETO) LIKE CATSFIELDS-DATETO OPTIONAL
*" TABLES
*" SAP_ICATSW STRUCTURE CATSW
*" SAP_ICATSW_FIX STRUCTURE CATSW OPTIONAL
" User-Exit specific for employees (SAP_PERNR)
" belonging to controlling area 1000
CALL FUNCTION 'Z_EXIT_SAPLCATS_001_1000'
EXPORTING
sap_tcats = sap_tcats
sap_pernr = sap_pernr
sap_dateleft = sap_dateleft
sap_dateright = sap_dateright
sap_datefrom = sap_datefrom
sap_dateto = sap_dateto
TABLES
sap_icatsw = sap_icatsw
sap_icatsw_fix = sap_icatsw_fix.
" User-Exit specific for employees (SAP_PERNR)
" belonging to controlling area 2000
CALL FUNCTION 'Z_EXIT_SAPLCATS_001_2000'
EXPORTING
sap_tcats = sap_tcats
sap_pernr = sap_pernr
sap_dateleft = sap_dateleft
sap_dateright = sap_dateright
sap_datefrom = sap_datefrom
sap_dateto = sap_dateto
TABLES
sap_icatsw = sap_icatsw
sap_icatsw_fix = sap_icatsw_fix.
ENDFUNCTION.
Finally, within the specific exit function module we define the condition when the exit should be executed:
FUNCTION z_exit_saplcats_001_1000.
*"*"Local Interface:
*" IMPORTING
*" VALUE(SAP_TCATS) LIKE TCATS STRUCTURE TCATS
*" VALUE(SAP_PERNR) LIKE CATSFIELDS-PERNR
*" VALUE(SAP_DATELEFT) LIKE CATSFIELDS-DATELEFT
*" VALUE(SAP_DATERIGHT) LIKE CATSFIELDS-DATERIGHT
*" VALUE(SAP_DATEFROM) LIKE CATSFIELDS-DATEFROM OPTIONAL
*" VALUE(SAP_DATETO) LIKE CATSFIELDS-DATETO OPTIONAL
*" TABLES
*" SAP_ICATSW STRUCTURE CATSW
*" SAP_ICATSW_FIX STRUCTURE CATSW OPTIONAL
IF ( <user BELONGS to CONTROLLING area 1000> ).
" execute user-exit
ELSE.
RETURN.
ENDIF.
ENDFUNCTION.
The alternative would be to place the entire coding including the conditions in the include ZXCATU01. However, in this case you can test the user exit <b>only in the context of the transaction</b> in which the user-exit is passed.
Using the strategy I have devised you are able to test the user-exit in general and the specific user-exits <b>independent </b>of the transaction. For example, if you are already working on 6.40 or higher then you could use ABAP Unit Testing for this purpose.
The same logic can be applied for BAdI where we can have only a single active implementation.
Finally, I hope to convince that it makes sense to spend some time into a reasonable strategy for implementing user-exits.
Regards
Uwe -
HOW to read file using ftp???
Hi to all,
I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
next code wich read this:
byte buffer[] = new byte[1024];
while( (readCount = input.read(buffer)) > 0) {
bos.write(buffer, 0, readCount);
but I dont know how to put all read data in one byte[] if i dont know length of file.
I can't do some like: byte file[] = new file[1000000];
Thanks for all sugestions!* Download a file from a FTP server. A FTP URL is generated with the following syntax:
* <code>ftp://user:password@host:port/filePath;type=i</code>.
* @param ftpServer FTP server address (incl. optional port ':portNumber').
* @param user Optional user name to login.
* @param pwd Optional password for <i>user</i>.
* @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
* @param destination Destination file to save.
* @throws MalformedURLException, IOException on error.
public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
if (ftpServer != null && fileName != null && destination != null) {
StringBuffer sb = new StringBuffer("ftp://");
if (user != null && pwd != null) { //need authentication?
sb.append(user);
sb.append(':');
sb.append(pwd);
sb.append('@');
}//else: anonymous access
sb.append(ftpServer);
sb.append('/');
sb.append(fileName);
sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
URL url = new URL(sb.toString());
URLConnection urlc = url.openConnection();
bis = new BufferedInputStream(urlc.getInputStream());
bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
int i;
while ((i = bis.read()) != -1) { //read next byte until end of stream
bos.write(i);
}//next byte
} finally {
if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
}//else: input unavailable
}//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream. -
How to connect server using FTP
hi all,
i have an exception while running this program.
import java.io.*;
import java.net.*;
class FTPclientConn {
public final String host;
public final String user;
protected final String password;
protected URLConnection urlc;
public FTPclientConn(String host, String user, String _password) {
host= host; user= user; password= _password;
urlc = null;
protected URL makeURL(String targetfile) throws MalformedURLException {
if (user== null)
return new URL("ftp://"+ host+ "/"+ targetfile+ ";type=i");
else
return new URL("ftp://"+ user+ ":"+ password+ "@"+ host+ "/"+ targetfile+ ";type=i");
protected InputStream openDownloadStream(String targetfile) throws Exception {
URL url= makeURL(targetfile);
urlc = url.openConnection();
InputStream is = urlc.getInputStream();
return is;
protected OutputStream openUploadStream(String targetfile) throws Exception {
URL url= makeURL(targetfile);
urlc = url.openConnection();
OutputStream os = urlc.getOutputStream();
return os;
protected void close() {
urlc= null;
public class FTPupload {
protected FTPclientConn cconn;
public final String localfile;
public final String targetfile;
public FTPupload(String host, String user, String _password,
String localfile, String targetfile) {
cconn= new FTPclientConn(_host, user, password);
localfile= _localfile;
targetfile= _targetfile;
doit();
public FTPupload(String host, String user, String password, String file) {
cconn= new FTPclientConn(_host, user, password);
localfile= _file;
targetfile= _file;
doit();
protected void doit() {
try {
OutputStream os= cconn.openUploadStream(targetfile);
FileInputStream is= new FileInputStream(localfile);
byte[] buf= new byte[16384];
int c;
while (true) {
//System.out.print(".");
c= is.read(buf);
if (c<= 0) break;
//System.out.print("[");
os.write(buf, 0, c);
//System.out.print("]");
os.close();
is.close();
cconn.close(); // section 3.2.5 of RFC1738
} catch (Exception E) {
System.err.println(E.getMessage());
E.printStackTrace();
public static void main(String args[]) {
// Usage: FTPupload host, user, password, file
new FTPupload(args[0], args[1], args[2], args[3]);
i gave the input in command prompt: java FTPupload 172.16.2.1 username password filename and also i am getting exception as
D:\ftp>java FTPupload 172.16.2.1 hariraj raj_123 ftpcheck.java
Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
how to resolve this problem.thanks in advance.Connection refused means that you can't reach the server or that the server isn't listening.
Kaj -
Hi all,
I have some data in a database and am about to start to write a simple querying / viewing application (probably Swing/webstart, maybe JSP). Because of the nature of the data, we are only licensed for a single concurrent user, so i have to make sure that not more than one person can use an instance of my app at the same time. Any ideas how i can acheive this?
Many thanks
AlistairHi all,
I have some data in a database and am about to start
to write a simple querying / viewing application
(probably Swing/webstart, maybe JSP). Because of the
nature of the data, we are only licensed for a single
concurrent user, so i have to make sure that not more
than one person can use an instance of my app at the
same time. Any ideas how i can acheive this?
Many thanks
AlistairOkay. Create a facade over all your database related code and then ensure that the database facade class is a singleton class. And all the different threads perform DB access through your database facade class. -
Site Definition losing FTP User ID and Password
My configuration:
iMac 2.4 GHz Intel C2D
10.6.1 Snow Leopard
DW v10 (Build 4117)
Not sure if my issue is related to the one described in this thread.
I recently performed a clean install of Snow Leopard and DW. Afterwards I imported my site definitions and everything was fine. On quiting and then re-opening DW the FTP User ID and (optionally Password) in the site sefinition(s) have disappeared. I re-entered them and am able to connect to my site(s) via FTP, but again on closing and re-opening DW the information has disappeared again.
What I've done;
- deleted and re-configured all Site Definitions several times.
- deleted the ~/Library/Application Support/Adobe/Dreamweaver CS4/en_US/Configuration/ folder
but still the problem persists.
Not sure if this a Snow Leopard/DW incompatibility issue, but I do recall this happening maybe once or twice with Leopard.
Any help would be gratefully appreciated.I beleive this happens if:
- you are using a trial version
- you don't enter your keychain password to record this information
I lost my kechain passwordon my mac,and i have to reenter password and FTP info everytime. Very frustrating util I can find the time to figure out how to reset my Mac keychain password. -
I have three users each with PC/Mac and iPods, how do I overcome the '5 user limit'?
I have three users each with PC/Mac and iPods, how do I overcome the '5 user limit'? If I create a new acct, will it blow out the library on the iPod?
thxYou don't. 5 is the limit of COMPUTERS that can be authorized to a single itunes account. Ipods/iphones/ipad/Apple Tvs do NOT count toward the 5.
Maybe you are looking for
-
I have just spent the last few weeks using HandBrake to rip the video files off my TV Season and movie DVDs and importing them into iTunes. I used the same exact rip settings for all my DVDs. There are some that are able to be synced to my Apple TV,
-
Hey yall, I was wondering if there is a cable that I can hook to my video out port on my iBook so I can hook it up to my Television. If there is can you tell me what it is called or a link to a website that would have one? Thanks in advance, Luke
-
Hi, We have a requirement where we need to add Z fields in SOS tab using FPM. How this can be acheived ? As of now we added the Zfields in the standard structure BBP_PDS_PARTNER using include INCL_EEW_PD_PARTNER_CSF. Enhanced Standard WDC /SAPSRM/WDC
-
i have a problem with my iphone 5S,my phone can't to start.it suddenly shutdown and can't to get started.now,i'am at india.what i have to do right now?
-
Hi Guys, in former Essbase 11 and Essbase 9 Versions it was possible to remove the shared services authentication by modifing the OlapAdmin.properties file. After an successfull 11.1.2.0 installation I can't find that file anymore. Does anybody know